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 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"); }
int32_t handle_event(android_app *app, AInputEvent *e) { record_message(bag); return 0; }