LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int iwnd = get_iwnd(hWnd); if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) return DefWindowProc(hWnd, message, wParam, lParam); switch(message) { case WM_QUERYNEWPALETTE: { HDC hdc = GetDC(0); int bits = GetDeviceCaps(hdc,BITSPIXEL); ok( bits == 8 , "expected WM_QUERYNEWPALETTE only on 8bpp\n"); ReleaseDC(0, hdc); return FALSE; } case WM_IME_SETCONTEXT: case WM_IME_NOTIFY : case WM_GETICON : case WM_GETTEXT: break; case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: { WINDOWPOS* pwp = (WINDOWPOS*)lParam; ok(wParam==0,"expected wParam=0\n"); RECOND_MESSAGE(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter), pwp->flags); break; } default: RECOND_MESSAGE(iwnd, message, SENT, 0,0); } return DefWindowProc(hWnd, message, wParam, lParam); }
LRESULT CALLBACK DWPTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int iwnd = get_iwnd(hWnd); if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) return DefWindowProc(hWnd, message, wParam, lParam); switch(message) { case WM_IME_SETCONTEXT: case WM_IME_NOTIFY : case WM_GETICON : case WM_GETTEXT: break; case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: { WINDOWPOS* pwp = (WINDOWPOS*)lParam; ok(wParam==0,"expected wParam=0\n"); RECOND_MESSAGE(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter), pwp->flags); break; } default: RECOND_MESSAGE(iwnd, message, SENT, 0,0); } return DefWindowProc(hWnd, message, wParam, lParam); }
LRESULT CALLBACK TmeTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int iwnd = get_iwnd(hWnd); if(message == WM_PAINT) { PAINTSTRUCT ps; BeginPaint(hWnd, &ps); Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); EndPaint(hWnd, &ps); } if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) return DefWindowProc(hWnd, message, wParam, lParam); switch(message) { case WM_IME_SETCONTEXT: case WM_IME_NOTIFY : case WM_GETICON : case WM_GETTEXT: break; case WM_SYSTIMER: ok(0, "Got unexpected WM_SYSTIMER in the winproc. wParam=%d\n", wParam); break; default: RECOND_MESSAGE(iwnd, message, SENT, 0,0); } return DefWindowProc(hWnd, message, wParam, lParam); }
static DWORD WINAPI thread_proc(void *param) { THREAD_DATA* current_data = (THREAD_DATA*)param; MSG msg; HDESK hdesk = NULL; int iwnd; if(current_data->Desktop) { hdesk = CreateDesktopW(current_data->Desktop, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL ); SetThreadDesktop(hdesk); } /* create test window */ current_data->hWnd = CreateWindowW(L"TestClass", L"test", WS_OVERLAPPEDWINDOW, 100, 100, 500, 500, NULL, NULL, 0, NULL); SetEvent( current_data->StartEvent ); iwnd = get_iwnd(current_data->hWnd); /* Use MsgWaitForMultipleObjects to let the thread process apcs */ while( GetMessage(&msg, 0,0,0) ) { if(msg.message > 0 && msg.message < WM_APP && msg.message != WM_TIMER ) record_message(&data[iwnd].cache, iwnd, msg.message, POST, msg.wParam,0); DispatchMessage(&msg); } if(hdesk) CloseDesktop(hdesk); return 0; }
LRESULT CALLBACK TestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int iwnd = get_iwnd(hWnd); if(iwnd >= 0 && message > 0 && message < WM_APP && message != WM_TIMER) record_message(&data[iwnd].cache, iwnd, message, SENT, wParam,0); return DefWindowProc(hWnd, message, wParam, lParam); }
static LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) { MOUSEHOOKSTRUCT *hs = (MOUSEHOOKSTRUCT*) lParam; LRESULT ret; RECOND_MESSAGE(get_iwnd(hs->hwnd), WH_MOUSE, HOOK, wParam, hs->wHitTestCode); ret = CallNextHookEx(hMouseHook, nCode, wParam, lParam); if(ignore_mouse) return TRUE; return ret; }
static void FlushMessages() { MSG msg; while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) { int iwnd = get_iwnd(msg.hwnd); if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message))) RECOND_MESSAGE(iwnd, msg.message, POST,0,0); DispatchMessageA( &msg ); } }
static LRESULT CALLBACK WndProc( _In_ HWND hWnd, _In_ UINT message, _In_ WPARAM wParam, _In_ LPARAM lParam) { HWND hTest; int iwnd = get_iwnd(hWnd, TRUE); ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId); if (message > WM_USER || IsDWmMsg(message) || IseKeyMsg(message)) return DefWindowProcW(hWnd, message, wParam, lParam); RECORD_MESSAGE(iwnd, message, SENT, wParam, lParam); switch(message) { case WM_DESTROY: if (GetParent(hWnd)) { /* child window */ ok(EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Child window %p (%d) enumerated\n", hWnd, iwnd); ok(!EnumChildWindows(GetParent(hWnd), EnumProc, (LPARAM)hWnd), "Child window %p (%d) not enumerated\n", hWnd, iwnd); ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)GetParent(hWnd)), "Parent window of %p (%d) not enumerated\n", hWnd, iwnd); } else { /* top-level window */ ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Window %p (%d) not enumerated in WM_DESTROY\n", hWnd, iwnd); } if (hWnd == hWndList[3]) { hTest = SetParent(hWndList[4], hWndList[2]); ok_hwnd(hTest, hWndList[1]); hTest = SetParent(hWndList[5], hWndList[1]); ok_hwnd(hTest, hWndList[2]); ok_hwnd(GetParent(hWndList[1]), NULL); ok_hwnd(GetParent(hWndList[2]), NULL); ok_hwnd(GetParent(hWndList[3]), hWndList[1]); ok_hwnd(GetParent(hWndList[4]), hWndList[2]); ok_hwnd(GetParent(hWndList[5]), hWndList[1]); } break; } return DefWindowProcW(hWnd, message, wParam, lParam); }
static void FlushMessages() { MSG msg; while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) { int iwnd = get_iwnd(msg.hwnd); if(iwnd) { if(msg.message == WM_SYSTIMER) { RECOND_MESSAGE(iwnd, msg.message, POST,msg.wParam,0); if(ignore_timer) continue; } else if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message))) RECOND_MESSAGE(iwnd, msg.message, POST,0,0); } DispatchMessageA( &msg ); } }
static void FlushMessages() { MSG msg; LRESULT res; while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) { int iwnd = get_iwnd(msg.hwnd); if( iwnd >= 0 && msg.message > 0 && msg.message < WM_APP && msg.message != WM_TIMER) record_message(&data[0].cache, iwnd, msg.message, POST, msg.wParam,0); DispatchMessageA( &msg ); } /* Use SendMessage to sync with the other queues */ res = SendMessageTimeout(data[1].hWnd, WM_APP, 0,0, SMTO_NORMAL, 1000, NULL); ok (res != ERROR_TIMEOUT, "SendMessageTimeout timed out\n"); res = SendMessageTimeout(data[2].hWnd, WM_APP, 0,0, SMTO_NORMAL, 1000, NULL); ok (res != ERROR_TIMEOUT, "SendMessageTimeout timed out\n"); res = SendMessageTimeout(data[3].hWnd, WM_APP, 0,0, SMTO_NORMAL, 1000, NULL); ok (res != ERROR_TIMEOUT, "SendMessageTimeout timed out\n"); res = SendMessageTimeout(data[4].hWnd, WM_APP, 0,0, SMTO_NORMAL, 1000, NULL); ok (res != ERROR_TIMEOUT, "SendMessageTimeout timed out\n"); }