15,473
社区成员




switch (message)
{
case HM_MOUSE:
count++;
wchar_t str[128];
wsprintf(str,L"第%d次收到鼠标左键点击消息!",count);
::SetWindowText(hWnd,str);
break;
int WINAPI wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HWND hwnd = CreateWindowW(L"BUTTON",L" ",WS_OVERLAPPED,200,200,300,50,NULL,NULL,hInstance,NULL);
::ShowWindow(hwnd,true);
::UpdateWindow(hwnd);
SetupHook(hwnd,true);
MSG msg;
while (GetMessageW(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
while (GetMessageW(&msg, NULL, 0, 0))
{
if(msg.message == HM_MOUSE)
{
count++;
wchar_t str[128];
wsprintf(str,L"第%d次收到鼠标左键点击消息!",count);
::SetWindowText(hwnd,str);
::UpdateWindow(hwnd);
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}