DWORD error;
HMODULE hinst, hUser32;
BOOL (WINAPI*SetShellWindow)(HWND);
- BOOL (WINAPI*SetShellWindowEx)(HWND, HWND);
HWND hwnd1, hwnd2, hwnd3, hwnd4, hwnd5;
HWND shellWindow, nextWnd;
hUser32 = GetModuleHandleA("user32");
SetShellWindow = (void *)GetProcAddress(hUser32, "SetShellWindow");
- SetShellWindowEx = (void *)GetProcAddress(hUser32, "SetShellWindowEx");
trace("previous shell window: %p\n", shellWindow);
hwnd, topmost ? "" : "NOT ");
}
-static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E)
+static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E, DWORD style)
{
HWND hwnd_A, hwnd_B, hwnd_C, hwnd_F;
check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE);
hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
- WS_POPUP,
+ style,
100, 100, 100, 100,
hwnd_F, 0, GetModuleHandle(0), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_z_order(hwnd_C, hwnd_D, 0, hwnd_F, FALSE);
hwnd_B = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
- WS_POPUP,
+ style,
100, 100, 100, 100,
hwnd_F, 0, GetModuleHandle(0), NULL);
trace("hwnd_B %p\n", hwnd_B);
check_z_order(hwnd_B, hwnd_C, 0, hwnd_F, TRUE);
hwnd_A = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
- WS_POPUP,
+ style,
100, 100, 100, 100,
0, 0, GetModuleHandle(0), NULL);
trace("hwnd_A %p\n", hwnd_A);
/* make hwnd_C owned by a topmost window */
DestroyWindow( hwnd_C );
hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
- WS_POPUP,
+ style,
100, 100, 100, 100,
hwnd_A, 0, GetModuleHandle(0), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_wnd_state(hwnd, hwnd, hwnd, 0);
}
+struct create_window_thread_params
+{
+ HWND window;
+ HANDLE window_created;
+ HANDLE test_finished;
+};
+
+static DWORD WINAPI create_window_thread(void *param)
+{
+ struct create_window_thread_params *p = param;
+ DWORD res;
+ BOOL ret;
+
+ p->window = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ ret = SetEvent(p->window_created);
+ ok(ret, "SetEvent failed, last error %#x.\n", GetLastError());
+
+ res = WaitForSingleObject(p->test_finished, INFINITE);
+ ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError());
+
+ DestroyWindow(p->window);
+ return 0;
+}
+
static void test_SetForegroundWindow(HWND hwnd)
{
+ struct create_window_thread_params thread_params;
+ HANDLE thread;
+ DWORD res, tid;
BOOL ret;
HWND hwnd2;
+ MSG msg;
flush_events( TRUE );
ShowWindow(hwnd, SW_HIDE);
DestroyWindow(hwnd2);
check_wnd_state(hwnd, hwnd, hwnd, 0);
+
+ hwnd2 = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, 0, 0, 0, 0);
+ check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+
+ thread_params.window_created = CreateEvent(NULL, FALSE, FALSE, NULL);
+ ok(!!thread_params.window_created, "CreateEvent failed, last error %#x.\n", GetLastError());
+ thread_params.test_finished = CreateEvent(NULL, FALSE, FALSE, NULL);
+ ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError());
+ thread = CreateThread(NULL, 0, create_window_thread, &thread_params, 0, &tid);
+ ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError());
+ res = WaitForSingleObject(thread_params.window_created, INFINITE);
+ ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError());
+ check_wnd_state(hwnd2, thread_params.window, hwnd2, 0);
+
+ SetForegroundWindow(hwnd2);
+ check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+ todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
+ todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
+
+ SetEvent(thread_params.test_finished);
+ WaitForSingleObject(thread, INFINITE);
+ CloseHandle(thread_params.test_finished);
+ CloseHandle(thread_params.window_created);
+ CloseHandle(thread);
+ DestroyWindow(hwnd2);
}
static WNDPROC old_button_proc;
BOOL ret;
LRESULT res;
- ShowWindow(hwnd, SW_SHOW);
+ ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE );
GetWindowRect( child, &rc);
MapWindowPoints( NULL, hwnd, (POINT*) &rc, 2);
ret = GetUpdateRect( child, &rc2, 0);
+ ok( ret == 1, "Expected GetUpdateRect to return non-zero, got %d\n", ret);
ok( rc2.right > rc2.left && rc2.bottom > rc2.top,
"Update rectangle is empty!\n");
ValidateRect( hwnd, &rc);
ret = GetUpdateRect( child, &rc2, 0);
+ ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret);
ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
"Update rectangle %d,%d-%d,%d is not empty!\n", rc2.left, rc2.top,
rc2.right, rc2.bottom);
rgn = CreateRectRgnIndirect( &rc);
ValidateRgn( hwnd, rgn);
ret = GetUpdateRect( child, &rc2, 0);
+ ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret);
ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
"Update rectangle %d,%d-%d,%d is not empty!\n", rc2.left, rc2.top,
rc2.right, rc2.bottom);
BOOL ret;
HWND desktop = GetDesktopWindow();
HMENU hMenu;
- /* FIXME: This detection is not correct as it also covers (all?) XP+ */
- BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0;
HWND parent, child1, child2, child3, child4, sibling;
parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
if (!is_win9x) /* Win9x doesn't survive this test */
{
+ HWND ret;
+
ok(!SetParent(parent, child1), "SetParent should fail\n");
ok(!SetParent(child2, child3), "SetParent should fail\n");
ok(SetParent(child1, parent) != 0, "SetParent should not fail\n");
- ok(SetParent(parent, child2) != 0, "SetParent should not fail\n");
- ok(SetParent(parent, child3) != 0, "SetParent should not fail\n");
- ok(!SetParent(child2, parent), "SetParent should fail\n");
- ok(SetParent(parent, child4) != 0, "SetParent should not fail\n");
-
- check_parents(parent, child4, child4, 0, 0, child4, parent);
- check_parents(child1, parent, parent, parent, 0, child4, parent);
- check_parents(child2, desktop, parent, parent, parent, child2, parent);
- check_parents(child3, child2, child2, child2, 0, child2, parent);
- check_parents(child4, desktop, child2, child2, child2, child4, parent);
+ ret = SetParent(parent, child2);
+ todo_wine ok( !ret || broken( ret != 0 ), "SetParent should fail\n");
+ if (ret) /* nt4, win2k */
+ {
+ ret = SetParent(parent, child3);
+ ok(ret != 0, "SetParent should not fail\n");
+ ret = SetParent(child2, parent);
+ ok(!ret, "SetParent should fail\n");
+ ret = SetParent(parent, child4);
+ ok(ret != 0, "SetParent should not fail\n");
+ check_parents(parent, child4, child4, 0, 0, child4, parent);
+ check_parents(child1, parent, parent, parent, 0, child4, parent);
+ check_parents(child2, desktop, parent, parent, parent, child2, parent);
+ check_parents(child3, child2, child2, child2, 0, child2, parent);
+ check_parents(child4, desktop, child2, child2, child2, child4, parent);
+ }
+ else
+ {
+ ret = SetParent(parent, child3);
+ ok(ret != 0, "SetParent should not fail\n");
+ ret = SetParent(child2, parent);
+ ok(!ret, "SetParent should fail\n");
+ ret = SetParent(parent, child4);
+ ok(!ret, "SetParent should fail\n");
+ check_parents(parent, child3, child3, 0, 0, child2, parent);
+ check_parents(child1, parent, parent, parent, 0, child2, parent);
+ check_parents(child2, desktop, parent, parent, parent, child2, parent);
+ check_parents(child3, child2, child2, child2, 0, child2, parent);
+ check_parents(child4, desktop, child2, child2, child2, child4, parent);
+ }
}
else
skip("Win9x/WinMe crash\n");
static void test_Expose(void)
{
- ATOM atom;
WNDCLASSA cls;
HWND mw;
+
memset(&cls, 0, sizeof(WNDCLASSA));
cls.lpfnWndProc = TestExposedRegion_WndProc;
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszClassName = "TestExposeClass";
- atom = RegisterClassA(&cls);
+ RegisterClassA(&cls);
mw = CreateWindowA("TestExposeClass", "MainWindow", WS_VISIBLE|WS_OVERLAPPEDWINDOW,
0, 0, 200, 100, NULL, NULL, 0, NULL);
NULL, NULL, 0, &flags);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
+ flush_events( FALSE );
while(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE) != 0)
{
if (msg.message == WM_PAINT) loopcount++;
test_capture_1();
test_capture_2();
test_capture_3(hwndMain, hwndMain2);
- test_capture_4();
+
+ skip("skipping test_capture_4, that hangs on reactos\n");
+ //test_capture_4();
test_CreateWindow();
test_parent_owner();
test_NCRedraw();
test_children_zorder(hwndMain);
- test_popup_zorder(hwndMain2, hwndMain);
+ test_popup_zorder(hwndMain2, hwndMain, WS_POPUP);
+ test_popup_zorder(hwndMain2, hwndMain, 0);
test_keyboard_input(hwndMain);
test_mouse_input(hwndMain);
test_validatergn(hwndMain);
test_layered_window();
test_SetForegroundWindow(hwndMain);
-// test_shell_window();
+ test_shell_window();
test_handles( hwndMain );
test_winregion();