将Buddy窗口分配给Spin Control - ResEdit(C ++)

时间:2011-08-29 04:44:55

标签: c++ winapi resources controls messages

如何使用ResEdit将好友窗口分配给旋转控件? (C ++) 另外,当按下向上和向下箭头(在控件上)时,如何找出控件发送的消息。 ResEdit代码:

// 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  = (HBRUSH)(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);

2 个答案:

答案 0 :(得分:3)

旋转控件的文档是here。要分配好友,您可以使用UDM_SETBUDDY

SendMessage( hwndSpinControl, UDM_SETBUDDY, hwndBuddyControl, NULL );

您不会通过UDN_DELTAPOS notification通知您的价值变化。

答案 1 :(得分:0)

您已经在使用ResEdit,为什么不在属性窗口中使用内置的auto-buddy属性?