开发者

Assigning Buddy window to Spin Control - ResEdit (C++)

开发者 https://www.devze.com 2023-04-01 12:45 出处:网络
How do I assign a buddy window to the Spin Control using ResEdit ? (C++) Also, how do I find out what messages the control sends when the up and down arrows (on the control) are pressed.

How do I assign a buddy window to the Spin Control using ResEdit ? (C++) Also, how do I find out what messages the control sends when the up and down arrows (on the control) are pressed. ResEdit Code:

// Generated by ResEdit 1.5.7
// Copyright (C) 2006-2010
// http://www.resedit.net

HINSTANCE hInst = GetModuleHandle(0);
WNDCLASSEX wcex;
ZeroMemory(&wcex, sizeof wcex);
wcex.cbSize         = sizeof wcex;
wcex.hbrBackground  = (HBRUS开发者_开发百科H)(COLOR_3DFACE + 1);
wcex.lpszMenuName   = 0;


wcex.style          = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc    = DefWindowProc;
wcex.hInstance      = hInst;
wcex.hIcon          = LoadIcon(0, (LPCTSTR)IDI_APPLICATION);
wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
wcex.lpszClassName  = "WndClass0";
RegisterClassEx(&wcex);

HFONT hfont0 = CreateFont(-13, 0, 0, 0, 0, FALSE, FALSE, FALSE, 1, 0, 0, 0, 0, ("Lucida Sans"));
HWND hwnd = CreateWindowEx(0, ("WndClass")0, ("Bet"), WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU, 0, 0, 1997564195, 218, 0, 0, hInst, 0);
HWND hCtrl0_0 = CreateWindowEx(0, WC_BUTTON, ("Enter Bet Amount"), WS_VISIBLE | WS_CHILD | 0x00000007, 10, 28, 206, 169, hwnd, (HMENU)IDC_STATIC, hInst, 0);
SendMessage(hCtrl0_0, WM_SETFONT, (WPARAM), FALSE);
HWND hCtrl0_1 = CreateWindowEx(0, UPDOWN_CLASS, 0, WS_VISIBLE | WS_CHILD | UDS_ALIGNLEFT | UDS_ARROWKEYS | UDS_SETBUDDYINT, 160, 84, 18, 34, hwnd, (HMENU)IDC_SPIN1, hInst, 0);
SendMessage(hCtrl0_1, WM_SETFONT, (WPARAM), FALSE);
HWND hCtrl0_2 = CreateWindowEx(0, WC_BUTTON, ("OK"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_NOTIFY, 22, 178, 50, 26, hwnd, (HMENU)IDC_OK, hInst, 0);
SendMessage(hCtrl0_2, WM_SETFONT, (WPARAM), FALSE);
HWND hCtrl0_3 = CreateWindowEx(0, WC_BUTTON, ("Reset"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 100, 178, 78, 26, hwnd, (HMENU)IDC_CANCE, hInst, 0);
SendMessage(hCtrl0_3, WM_SETFONT, (WPARAM), FALSE);


The documentation for the spin control is here. To assign the buddy, you can use UDM_SETBUDDY:

SendMessage( hwndSpinControl, UDM_SETBUDDY, hwndBuddyControl, NULL );

You will not notified of value changes by the UDN_DELTAPOS notification.


You're using ResEdit already, why dont you just use the built-in auto-buddy property in the properties window?


Set value of the Spin Control field "Insert after" next to the Text Edit's one. Select value for "Aligment" (e.g. UDS_ALIGNRIGHT style flag). You can also set true value for "Auto buddy" (UDS_AUTOBUDDY style flag). Spin Control sends WM_VSCROLL message with his own ID.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号