{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
if (remove_messages)
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
diff = time - GetTickCount();
min_timeout = 50;
}
"wrong error %u\n", GetLastError() );
}
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
count = 0;
ret = EnumThreadWindows( GetCurrentThreadId(), enum_proc, (LPARAM)&count );
{
case WM_GETMINMAXINFO:
{
- MINMAXINFO* minmax = (MINMAXINFO *)lparam;
-
- trace("WM_GETMINMAXINFO: hwnd %p, %08lx, %08lx\n", hwnd, wparam, lparam);
- dump_minmax_info( minmax );
SetWindowLongPtrA(hwnd, GWLP_USERDATA, 0x20031021);
break;
}
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS *winpos = (WINDOWPOS *)lparam;
- trace("main: WM_WINDOWPOSCHANGING %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
if (!(winpos->flags & SWP_NOMOVE))
{
ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x);
{
RECT rc1, rc2;
WINDOWPOS *winpos = (WINDOWPOS *)lparam;
- trace("main: WM_WINDOWPOSCHANGED %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
- winpos->hwnd, winpos->hwndInsertAfter,
- winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x);
ok(winpos->y >= -32768 && winpos->y <= 32767, "bad winpos->y %d\n", winpos->y);
BOOL got_getminmaxinfo = GetWindowLongPtrA(hwnd, GWLP_USERDATA) == 0x20031021;
CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
- trace("WM_NCCREATE: hwnd %p, parent %p, style %08x\n", hwnd, cs->hwndParent, cs->style);
- if (got_getminmaxinfo)
- trace("%p got WM_GETMINMAXINFO\n", hwnd);
-
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
ok(got_getminmaxinfo, "main: WM_GETMINMAXINFO should have been received before WM_NCCREATE\n");
else
{
case WM_GETMINMAXINFO:
{
- MINMAXINFO* minmax = (MINMAXINFO *)lparam;
-
- trace("hwnd %p, WM_GETMINMAXINFO, %08lx, %08lx\n", hwnd, wparam, lparam);
- dump_minmax_info( minmax );
SetWindowLongPtrA(hwnd, GWLP_USERDATA, 0x20031021);
break;
}
BOOL got_getminmaxinfo = GetWindowLongPtrA(hwnd, GWLP_USERDATA) == 0x20031021;
CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
- trace("WM_NCCREATE: hwnd %p, parent %p, style %08x\n", hwnd, cs->hwndParent, cs->style);
- if (got_getminmaxinfo)
- trace("%p got WM_GETMINMAXINFO\n", hwnd);
-
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
ok(got_getminmaxinfo, "tool: WM_GETMINMAXINFO should have been received before WM_NCCREATE\n");
else
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MainWindowClass";
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "ToolWindowClass";
/* win2k and XP return broken border info in GetWindowInfo most of
* the time, so there is no point in testing it.
*/
-#if 0
+if (0)
+{
UINT border;
ok(info->cxWindowBorders == (unsigned)(rcClient.left - rcWindow.left),
"wrong cxWindowBorders %d != %d\n", info->cxWindowBorders, rcClient.left - rcWindow.left);
border = min(rcWindow.bottom - rcClient.bottom, rcClient.top - rcWindow.top);
ok(info->cyWindowBorders == border,
"wrong cyWindowBorders %d != %d\n", info->cyWindowBorders, border);
-#endif
+}
ok(info->atomWindowType == GetClassLongA(hwnd, GCW_ATOM), "wrong atomWindowType for %p in hook %s\n",
hwnd, hook);
ok(info->wCreatorVersion == 0x0400 /* NT4, Win2000, XP, Win2003 */ ||
}
shellWindow = GetShellWindow();
- hinst = GetModuleHandle(0);
+ hinst = GetModuleHandleA(NULL);
hUser32 = GetModuleHandleA("user32");
SetShellWindow = (void *)GetProcAddress(hUser32, "SetShellWindow");
CloseHandle(hProcess);
}
- hwnd1 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST1"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 100, 100, 300, 200, 0, 0, hinst, 0);
+ hwnd1 = CreateWindowExA(0, "#32770", "TEST1", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 100, 100, 300, 200, 0, 0, hinst, 0);
trace("created window 1: %p\n", hwnd1);
ret = SetShellWindow(hwnd1);
/* passes on Win XP, but not on Win98
ok(!ret, "third call to SetShellWindow(hwnd1)\n"); */
- SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
- ret = (GetWindowLong(hwnd1,GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+ SetWindowLongA(hwnd1, GWL_EXSTYLE, GetWindowLongA(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
+ ret = (GetWindowLongA(hwnd1,GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n");
ret = DestroyWindow(hwnd1);
ok(ret, "DestroyWindow(hwnd1)\n");
- hwnd2 = CreateWindowEx(WS_EX_TOPMOST, TEXT("#32770"), TEXT("TEST2"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 150, 250, 300, 200, 0, 0, hinst, 0);
+ hwnd2 = CreateWindowExA(WS_EX_TOPMOST, "#32770", "TEST2", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 150, 250, 300, 200, 0, 0, hinst, 0);
trace("created window 2: %p\n", hwnd2);
ret = SetShellWindow(hwnd2);
ok(!ret, "SetShellWindow(hwnd2) with WS_EX_TOPMOST\n");
- hwnd3 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST3"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 200, 400, 300, 200, 0, 0, hinst, 0);
+ hwnd3 = CreateWindowExA(0, "#32770", "TEST3", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 200, 400, 300, 200, 0, 0, hinst, 0);
trace("created window 3: %p\n", hwnd3);
- hwnd4 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST4"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 250, 500, 300, 200, 0, 0, hinst, 0);
+ hwnd4 = CreateWindowExA(0, "#32770", "TEST4", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 250, 500, 300, 200, 0, 0, hinst, 0);
trace("created window 4: %p\n", hwnd4);
nextWnd = GetWindow(hwnd4, GW_HWNDNEXT);
shellWindow = GetShellWindow();
ok(shellWindow==hwnd4, "wrong shell window: %p - expected hwnd4\n", shellWindow);
- hwnd5 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST5"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 300, 600, 300, 200, 0, 0, hinst, 0);
+ hwnd5 = CreateWindowExA(0, "#32770", "TEST5", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 300, 600, 300, 200, 0, 0, hinst, 0);
trace("created window 5: %p\n", hwnd5);
ret = SetWindowPos(hwnd4, hwnd5, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "SetWindowPos(hwnd4, hwnd5)\n");
mdi_cs.szClass = "MDI_child_Class_1";
mdi_cs.szTitle = "MDI child";
- mdi_cs.hOwner = GetModuleHandle(0);
+ mdi_cs.hOwner = GetModuleHandleA(NULL);
mdi_cs.x = CW_USEDEFAULT;
mdi_cs.y = CW_USEDEFAULT;
mdi_cs.cx = CW_USEDEFAULT;
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
if (!mdi_child)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
if (!mdi_child)
{
WS_CHILD,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- parent, 0, GetModuleHandle(0),
+ parent, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(!mdi_child, "WS_EX_MDICHILD with a not MDIClient parent should fail\n");
}
WS_CHILD, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_POPUP, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE | WS_CAPTION,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
DestroyWindow(mdi_child);
}
+static void test_MDI_child_stack(HWND mdi_client)
+{
+ HWND child_1, child_2, child_3, child_4;
+ HWND stack[4];
+ MDICREATESTRUCTA cs;
+
+ cs.szClass = "MDI_child_Class_1";
+ cs.szTitle = "MDI child";
+ cs.hOwner = GetModuleHandleA(0);
+ cs.x = CW_USEDEFAULT;
+ cs.y = CW_USEDEFAULT;
+ cs.cx = CW_USEDEFAULT;
+ cs.cy = CW_USEDEFAULT;
+ cs.style = 0;
+ cs.lParam = (LPARAM)mdi_lParam_test_message;
+
+ child_1 = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&cs);
+ ok(child_1 != 0, "expected child_1 to be non NULL\n");
+ child_2 = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&cs);
+ ok(child_2 != 0, "expected child_2 to be non NULL\n");
+ child_3 = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&cs);
+ ok(child_3 != 0, "expected child_3 to be non NULL\n");
+ child_4 = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&cs);
+ ok(child_4 != 0, "expected child_4 to be non NULL\n");
+
+ stack[0] = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
+ stack[1] = GetWindow(stack[0], GW_HWNDNEXT);
+ stack[2] = GetWindow(stack[1], GW_HWNDNEXT);
+ stack[3] = GetWindow(stack[2], GW_HWNDNEXT);
+ trace("Initial MDI child stack: %p->%p->%p->%p\n", stack[0], stack[1], stack[2], stack[3]);
+ ok(stack[0] == child_4 && stack[1] == child_3 &&
+ stack[2] == child_2 && stack[3] == child_1,
+ "Unexpected initial order, should be: %p->%p->%p->%p\n",
+ child_4, child_3, child_2, child_1);
+
+ trace("Activate child next to %p\n", child_3);
+ SendMessageA(mdi_client, WM_MDINEXT, (WPARAM)child_3, 0);
+
+ stack[0] = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
+ stack[1] = GetWindow(stack[0], GW_HWNDNEXT);
+ stack[2] = GetWindow(stack[1], GW_HWNDNEXT);
+ stack[3] = GetWindow(stack[2], GW_HWNDNEXT);
+ ok(stack[0] == child_2 && stack[1] == child_4 &&
+ stack[2] == child_1 && stack[3] == child_3,
+ "Broken MDI child stack:\nexpected: %p->%p->%p->%p, but got: %p->%p->%p->%p\n",
+ child_2, child_4, child_1, child_3, stack[0], stack[1], stack[2], stack[3]);
+
+ trace("Activate child previous to %p\n", child_1);
+ SendMessageA(mdi_client, WM_MDINEXT, (WPARAM)child_1, 1);
+
+ stack[0] = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, 0);
+ stack[1] = GetWindow(stack[0], GW_HWNDNEXT);
+ stack[2] = GetWindow(stack[1], GW_HWNDNEXT);
+ stack[3] = GetWindow(stack[2], GW_HWNDNEXT);
+ ok(stack[0] == child_4 && stack[1] == child_2 &&
+ stack[2] == child_1 && stack[3] == child_3,
+ "Broken MDI child stack:\nexpected: %p->%p->%p->%p, but got: %p->%p->%p->%p\n",
+ child_4, child_2, child_1, child_3, stack[0], stack[1], stack[2], stack[3]);
+
+ DestroyWindow(child_1);
+ DestroyWindow(child_2);
+ DestroyWindow(child_3);
+ DestroyWindow(child_4);
+}
+
/**********************************************************************
* MDI_ChildGetMinMaxInfo (copied from windows/mdi.c)
*
style = GetWindowLongA(hwnd, GWL_STYLE);
exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
- GetWindowRect(client, &rc);
- trace("MDI client %p window size = (%d x %d)\n", client, rc.right-rc.left, rc.bottom-rc.top);
GetClientRect(client, &rc);
- trace("MDI client %p client size = (%d x %d)\n", client, rc.right, rc.bottom);
- trace("screen size: %d x %d\n", GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN));
GetClientRect(client, &rc);
if ((style & WS_CAPTION) == WS_CAPTION)
WS_CHILD /*| WS_VISIBLE*/,
/* tests depend on a not zero MDIClient size */
0, 0, rc.right, rc.bottom,
- hwnd, 0, GetModuleHandle(0),
+ hwnd, 0, GetModuleHandleA(NULL),
&client_cs);
assert(mdi_client);
test_MDI_create(hwnd, mdi_client, client_cs.idFirstChild);
WS_CHILD | MDIS_ALLCHILDSTYLES /*| WS_VISIBLE*/,
/* tests depend on a not zero MDIClient size */
0, 0, rc.right, rc.bottom,
- hwnd, 0, GetModuleHandle(0),
+ hwnd, 0, GetModuleHandleA(NULL),
&client_cs);
assert(mdi_client);
test_MDI_create(hwnd, mdi_client, client_cs.idFirstChild);
DestroyWindow(mdi_client);
+
+ /* Test child window stack management */
+ mdi_client = CreateWindowExA(0, "mdiclient",
+ NULL,
+ WS_CHILD,
+ 0, 0, rc.right, rc.bottom,
+ hwnd, 0, GetModuleHandleA(NULL),
+ &client_cs);
+ assert(mdi_client);
+ test_MDI_child_stack(mdi_client);
+ DestroyWindow(mdi_client);
break;
}
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MDI_parent_Class";
WS_MAXIMIZEBOX /*| WS_VISIBLE*/,
100, 100, CW_USEDEFAULT, CW_USEDEFAULT,
GetDesktopWindow(), 0,
- GetModuleHandle(0), NULL);
+ GetModuleHandleA(NULL), NULL);
assert(mdi_hwndMain);
/*
while(GetMessage(&msg, 0, 0, 0))
{
WNDCLASSEXA cls;
HWND hwnd;
- HICON icon = LoadIconA(0, IDI_APPLICATION);
- HICON icon2 = LoadIconA(0, IDI_QUESTION);
- HICON small_icon = LoadImageA(0, IDI_APPLICATION, IMAGE_ICON,
+ HICON icon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ HICON icon2 = LoadIconA(0, (LPCSTR)IDI_QUESTION);
+ HICON small_icon = LoadImageA(0, (LPCSTR)IDI_APPLICATION, IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED );
HICON res;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = 0;
- cls.hIcon = LoadIconA(0, IDI_HAND);
+ cls.hIcon = LoadIconA(0, (LPCSTR)IDI_HAND);
cls.hIconSm = small_icon;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "IconWindowClass";
else InflateRect( rect, -10, -10 );
return 0;
}
- return DefWindowProc( hwnd, msg, wparam, lparam );
+ return DefWindowProcA( hwnd, msg, wparam, lparam );
}
static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
GetWindowRect(hwnd, &orig_win_rc);
- old_proc = SetWindowLongPtr( hwnd, GWLP_WNDPROC, (ULONG_PTR)nccalcsize_proc );
+ old_proc = SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (ULONG_PTR)nccalcsize_proc );
ret = SetWindowPos(hwnd, 0, 100, 100, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
ok(ret, "Got %d\n", ret);
GetWindowRect( hwnd, &rect );
ret = SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top,
orig_win_rc.right, orig_win_rc.bottom, 0);
ok(ret, "Got %d\n", ret);
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, old_proc );
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, old_proc );
/* Win9x truncates coordinates to 16-bit irrespectively */
if (!is_win9x)
orig_win_rc.right, orig_win_rc.bottom, 0);
ok(ret, "Got %d\n", ret);
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+ ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
ret = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
+ ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
ret = SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
+ ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+ ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
hwnd_desktop = GetDesktopWindow();
ok(!!hwnd_desktop, "Failed to get hwnd_desktop window (%d).\n", GetLastError());
ret = GetMenu(child);
ok(ret == (HMENU)10, "unexpected menu id %p\n", ret);
- style = GetWindowLong(child, GWL_STYLE);
- SetWindowLong(child, GWL_STYLE, style | WS_POPUP);
+ style = GetWindowLongA(child, GWL_STYLE);
+ SetWindowLongA(child, GWL_STYLE, style | WS_POPUP);
ok(SetMenu(child, hMenu), "SetMenu on a popup child window should not fail\n");
ok(SetMenu(child, 0), "SetMenu on a popup child window should not fail\n");
- SetWindowLong(child, GWL_STYLE, style);
+ SetWindowLongA(child, GWL_STYLE, style);
- SetWindowLong(child, GWL_STYLE, style | WS_OVERLAPPED);
- ok(!SetMenu(child, hMenu), "SetMenu on a overlapped child window should fail\n");
- SetWindowLong(child, GWL_STYLE, style);
+ SetWindowLongA(child, GWL_STYLE, style | WS_OVERLAPPED);
+ ok(!SetMenu(child, hMenu), "SetMenu on an overlapped child window should fail\n");
+ SetWindowLongA(child, GWL_STYLE, style);
DestroyWindow(child);
DestroyMenu(hMenu);
{
if (style[i] & DS_CONTROL)
{
- child[i] = CreateWindowExA(0, MAKEINTATOM(32770), "", style[i] & ~WS_VISIBLE,
+ child[i] = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(32770), "", style[i] & ~WS_VISIBLE,
0,0,0,0, parent, (HMENU)i, 0, NULL);
if (style[i] & WS_VISIBLE)
ShowWindow(child[i], SW_SHOW);
/* skip foreign windows */
while (test && test != next &&
(GetWindowThreadProcessId(test, NULL) != our_pid ||
- UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)) != GetModuleHandle(0) ||
+ UlongToHandle(GetWindowLongPtrA(test, GWLP_HINSTANCE)) != GetModuleHandleA(NULL) ||
GetWindow(test, GW_OWNER) == next))
{
/*trace("skipping next %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
/* skip foreign windows */
while (test && test != prev &&
(GetWindowThreadProcessId(test, NULL) != our_pid ||
- UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)) != GetModuleHandle(0) ||
+ UlongToHandle(GetWindowLongPtrA(test, GWLP_HINSTANCE)) != GetModuleHandleA(NULL) ||
GetWindow(test, GW_OWNER) == hwnd))
{
/*trace("skipping prev %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
test = GetWindow(hwnd, GW_OWNER);
ok_(file, line)(owner == test, "%p: expected owner %p, got %p\n", hwnd, owner, test);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok_(file, line)(!(ex_style & WS_EX_TOPMOST) == !topmost, "%p: expected %stopmost\n",
hwnd, topmost ? "" : "NOT ");
}
check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE);
check_z_order(hwnd_E, 0, hwnd_D, 0, FALSE);
- hwnd_F = CreateWindowEx(0, "MainWindowClass", "Owner window",
+ hwnd_F = CreateWindowExA(0, "MainWindowClass", "Owner window",
WS_OVERLAPPED | WS_CAPTION,
100, 100, 100, 100,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_F %p\n", hwnd_F);
check_z_order(hwnd_F, hwnd_D, 0, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE);
- hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_F, 0, GetModuleHandle(0), NULL);
+ hwnd_F, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, hwnd_C, 0, FALSE);
check_z_order(hwnd_C, hwnd_D, 0, hwnd_F, FALSE);
- hwnd_B = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
+ hwnd_B = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_F, 0, GetModuleHandle(0), NULL);
+ hwnd_F, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_B %p\n", hwnd_B);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_C, hwnd_D, hwnd_B, hwnd_F, FALSE);
check_z_order(hwnd_B, hwnd_C, 0, hwnd_F, TRUE);
- hwnd_A = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
+ hwnd_A = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_A %p\n", hwnd_A);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
/* make hwnd_C owned by a topmost window */
DestroyWindow( hwnd_C );
- hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_A, 0, GetModuleHandle(0), NULL);
+ hwnd_A, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_z_order(hwnd_E, 0, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, hwnd_F, 0, FALSE);
ok(GetFocus() == child, "Focus should be on child %p\n", child);
return 0;
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void test_SetFocus(HWND hwnd)
SetFocus(0);
SetFocus(hwnd);
ok( GetFocus() == hwnd, "Failed to set focus to visible window %p\n", hwnd );
- ok( GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE, "Window %p not visible\n", hwnd );
+ ok( GetWindowLongA(hwnd,GWL_STYLE) & WS_VISIBLE, "Window %p not visible\n", hwnd );
ShowWindow(hwnd, SW_HIDE);
SetFocus(0);
SetFocus(hwnd);
ok( GetFocus() == hwnd, "Failed to set focus to invisible window %p\n", hwnd );
- ok( !(GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE), "Window %p still visible\n", hwnd );
+ ok( !(GetWindowLongA(hwnd,GWL_STYLE) & WS_VISIBLE), "Window %p still visible\n", hwnd );
child = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, hwnd, 0, 0, NULL);
assert(child);
SetFocus(child);
ok( GetFocus() == child, "Failed to set focus to invisible child %p\n", child );
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ShowWindow(child, SW_SHOW);
- ok( GetWindowLong(child,GWL_STYLE) & WS_VISIBLE, "Child %p is not visible\n", child );
+ ok( GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE, "Child %p is not visible\n", child );
ok( GetFocus() == child, "Focus no longer on child %p\n", child );
ShowWindow(child, SW_HIDE);
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() );
ShowWindow(child, SW_SHOW);
child2 = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, child, 0, 0, NULL);
ShowWindow(child2, SW_SHOW);
SetFocus(child2);
ShowWindow(child, SW_HIDE);
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == child2, "Focus should be on %p, not %p\n", child2, GetFocus() );
ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() != child, "Focus should not be on child %p\n", child );
todo_wine
ok( GetFocus() != hwnd, "Focus should not be on parent %p\n", hwnd );
- old_wnd_proc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)set_focus_on_activate_proc);
+ old_wnd_proc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)set_focus_on_activate_proc);
ShowWindow(hwnd, SW_RESTORE);
ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
todo_wine
ok( GetFocus() == child, "Focus should be on child %p, not %p\n", child, GetFocus() );
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
+ SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
SetFocus( hwnd );
SetParent( child, GetDesktopWindow());
SetActiveWindow(0);
check_wnd_state(0, 0, 0, 0);
- trace("testing SetActiveWindow %p\n", hwnd);
+ /*trace("testing SetActiveWindow %p\n", hwnd);*/
ShowWindow(hwnd, SW_SHOW);
check_wnd_state(hwnd, hwnd, hwnd, 0);
SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
check_wnd_state(hwnd, hwnd, hwnd, 0);
- trace("testing ShowWindow SW_HIDE window %p\n", hwnd);
+
ShowWindow(hwnd, SW_HIDE);
check_wnd_state(0, 0, 0, 0);
- trace("testing SetActiveWindow on an invisible window %p\n", hwnd);
+ /*trace("testing SetActiveWindow on an invisible window %p\n", hwnd);*/
SetActiveWindow(hwnd);
check_wnd_state(hwnd, hwnd, hwnd, 0);
BOOL ret;
HWND hwnd2;
MSG msg;
+ LONG style;
flush_events( TRUE );
ShowWindow(hwnd, SW_HIDE);
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);
+ thread_params.window_created = CreateEventW(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);
+ thread_params.test_finished = CreateEventW(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());
SetForegroundWindow(hwnd2);
check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&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());
+ SetForegroundWindow(hwnd);
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+ style = GetWindowLongA(hwnd2, GWL_STYLE) | WS_CHILD;
+ ok(SetWindowLongA(hwnd2, GWL_STYLE, style), "SetWindowLong failed\n");
+ ok(SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n");
+ check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+
+ SetForegroundWindow(hwnd);
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+ ok(SetWindowLongA(hwnd2, GWL_STYLE, style & (~WS_POPUP)), "SetWindowLong failed\n");
+ ok(!SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n");
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+
SetEvent(thread_params.test_finished);
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread_params.test_finished);
/* button wnd proc should release capture on WM_KILLFOCUS if it does
* match internal button state.
*/
- SendMessage(button, WM_KILLFOCUS, 0, 0);
+ SendMessageA(button, WM_KILLFOCUS, 0, 0);
check_wnd_state(button, button, button, 0);
ShowWindow(hwnd, SW_SHOW);
/* button wnd proc should ignore WM_KILLFOCUS if it doesn't match
* internal button state.
*/
- SendMessage(button, WM_KILLFOCUS, 0, 0);
+ SendMessageA(button, WM_KILLFOCUS, 0, 0);
check_wnd_state(button, button, button, button);
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
}
cap_wnd = GetCapture();
+ ok(cap_wnd == (HWND)lParam, "capture window %p does not match lparam %lx\n", cap_wnd, lParam);
+ todo_wine ok(cap_wnd == hWnd, "capture window %p does not match hwnd %p\n", cap_wnd, hWnd);
+
/* check that re-setting the capture for the menu fails */
set_cap_wnd = SetCapture(cap_wnd);
ok(!set_cap_wnd || broken(set_cap_wnd == cap_wnd), /* nt4 */
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = test_capture_4_proc;
wclass.hInstance = hInstance;
- wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
- wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
+ wclass.hIcon = LoadIconA( 0, (LPCSTR)IDI_APPLICATION );
+ wclass.hCursor = LoadCursorA( 0, (LPCSTR)IDC_ARROW );
wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
ret = peek_message(msg);
if (ret)
{
- if (msg->message == WM_PAINT) DispatchMessage(msg);
+ if (msg->message == WM_PAINT) DispatchMessageA(msg);
else break;
}
else if (MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
if (msg.message == WM_TIMER || ignore_message(msg.message)) continue;
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE,
"hwnd %p message %04x\n", msg.hwnd, msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ret = peek_message(&msg);
ok( !ret, "message %04x available\n", msg.message);
0, rc1.left, rc1.top, rc1.right, rc1.bottom);
/* same test, but with client edge: not enough width */
- SetWindowLong( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLong( hwnd, GWL_EXSTYLE));
+ SetWindowLongA( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLongA( hwnd, GWL_EXSTYLE));
nccalchelper( hwnd, sbwidth, 100, &rc1);
ok( rc1.right - rc1.left == sbwidth - 2 * GetSystemMetrics(SM_CXEDGE),
"Width should be %d size is %d,%d - %d,%d\n",
ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n");
ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n");
+ ok(SetParent(parent, desktop) != 0, "SetParent should not fail\n");
+ ok(SetParent(child4, child3) != 0, "SetParent should not fail\n");
+ ok(SetParent(child3, child2) != 0, "SetParent should not fail\n");
+ ok(SetParent(child2, child1) != 0, "SetParent should not fail\n");
+ ok(!IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
+ SetWindowLongW(child4, GWL_STYLE, WS_CHILD);
+ ok(IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
+ ok(IsChild(child2, child4), "wrong parent/child %p/%p\n", child2, child4);
+ ok(!IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
+ SetWindowLongW(child2, GWL_STYLE, WS_CHILD);
+ ok(IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
+ ok(IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4);
+
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
ok(!IsWindow(parent), "parent still exists\n");
ret = SetParent(popup, child1);
ok(ret == desktop, "expected %p, got %p\n", desktop, ret);
check_parents(popup, child1, child1, 0, 0, parent, popup);
-todo_wine
check_active_state(popup, 0, popup);
+ SetActiveWindow(parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+
+ EnableWindow(child1, FALSE);
+ check_active_state(popup, 0, popup);
+ SetFocus(parent);
+ check_active_state(parent, 0, parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+ EnableWindow(child1, TRUE);
+
+ ShowWindow(child1, SW_MINIMIZE);
+ SetFocus(parent);
+ check_active_state(parent, 0, parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+ ShowWindow(child1, SW_HIDE);
+
SetActiveWindow(parent);
SetFocus(parent);
check_active_state(parent, 0, parent);
bret = SetForegroundWindow(popup);
-todo_wine {
- ok(bret || broken(!bret), "SetForegroundWindow() failed\n");
- if (!bret)
- check_active_state(popup, 0, popup);
- else
- check_active_state(popup, popup, popup);
- }
+ ok(bret, "SetForegroundWindow() failed\n");
+ check_active_state(popup, popup, popup);
+
+ ShowWindow(parent, SW_SHOW);
+ SetActiveWindow(popup);
+ ok(DestroyWindow(popup), "DestroyWindow() failed\n");
+ check_active_state(parent, parent, parent);
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
static LRESULT WINAPI StyleCheckProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
- LPCREATESTRUCT lpcs;
+ LPCREATESTRUCTA lpcs;
LPSTYLESTRUCT lpss;
switch (msg)
{
case WM_NCCREATE:
case WM_CREATE:
- lpcs = (LPCREATESTRUCT)lparam;
+ lpcs = (LPCREATESTRUCTA)lparam;
lpss = lpcs->lpCreateParams;
if (lpss)
{
}
break;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static ATOM atomStyleCheckClass;
static void register_style_check_class(void)
{
- WNDCLASS wc =
+ WNDCLASSA wc =
{
0,
StyleCheckProc,
0,
0,
- GetModuleHandle(NULL),
+ GetModuleHandleA(NULL),
NULL,
- LoadCursor(NULL, IDC_ARROW),
+ LoadCursorA(0, (LPCSTR)IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE+1),
NULL,
- TEXT("WineStyleCheck"),
+ "WineStyleCheck",
};
-
- atomStyleCheckClass = RegisterClass(&wc);
+
+ atomStyleCheckClass = RegisterClassA(&wc);
assert(atomStyleCheckClass);
}
if (dwStyleIn & WS_CHILD)
{
- hwndParent = CreateWindowEx(0, MAKEINTATOM(atomStyleCheckClass), NULL,
+ hwndParent = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
}
- hwnd = CreateWindowEx(dwExStyleIn, MAKEINTATOM(atomStyleCheckClass), NULL,
+ hwnd = CreateWindowExA(dwExStyleIn, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
dwStyleIn, 0, 0, 0, 0, hwndParent, NULL, NULL, &ss);
assert(hwnd);
flush_events( TRUE );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
/* try setting the styles explicitly */
- SetWindowLong( hwnd, GWL_EXSTYLE, dwExStyleIn );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA( hwnd, GWL_EXSTYLE, dwExStyleIn );
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_EX_WINDOWEDGE can't always be changed */
if (dwExStyleIn & WS_EX_DLGMODALFRAME)
dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
- SetWindowLong( hwnd, GWL_STYLE, dwStyleIn );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA( hwnd, GWL_STYLE, dwStyleIn );
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_CLIPSIBLINGS can't be reset on top-level windows */
if ((dwStyleIn & (WS_CHILD|WS_POPUP)) == WS_CHILD) dwStyleOut = dwStyleIn;
else dwStyleOut = dwStyleIn | WS_CLIPSIBLINGS;
HWND hwnd, parent = 0;
if (style_in & WS_CHILD)
- parent = CreateWindowEx(0, "static", NULL, WS_OVERLAPPEDWINDOW,
+ parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
0, 0, 0, 0, NULL, NULL, NULL, NULL);
dlg_data.dt.style = style_in;
dlg_data.class_atom = 0;
dlg_data.caption[0] = 0;
- hwnd = CreateDialogIndirectParam(GetModuleHandle(0), &dlg_data.dt, parent, empty_dlg_proc, 0);
+ hwnd = CreateDialogIndirectParamA(GetModuleHandleA(NULL), &dlg_data.dt, parent, empty_dlg_proc, 0);
ok(hwnd != 0, "dialog creation failed, style %#x, exstyle %#x\n", style_in, ex_style_in);
flush_events( TRUE );
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(style == (style_out | DS_3DLOOK), "expected style %#x, got %#x\n", style_out | DS_3DLOOK, style);
ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
/* try setting the styles explicitly */
- SetWindowLong(hwnd, GWL_EXSTYLE, ex_style_in);
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA(hwnd, GWL_EXSTYLE, ex_style_in);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(style == (style_out | DS_3DLOOK), "expected style %#x, got %#x\n", style_out|DS_3DLOOK, style);
/* WS_EX_WINDOWEDGE can't always be changed */
if (ex_style_in & WS_EX_DLGMODALFRAME)
ex_style_out = ex_style_in & ~WS_EX_WINDOWEDGE;
ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
- SetWindowLong(hwnd, GWL_STYLE, style_in);
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA(hwnd, GWL_STYLE, style_in);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_CLIPSIBLINGS can't be reset on top-level windows */
if ((style_in & (WS_CHILD | WS_POPUP)) == WS_CHILD) style_out = style_in;
else style_out = style_in | WS_CLIPSIBLINGS;
SetRectRgn( clipping, 10, 10, 90, 90);
hdc = GetDC( hwnd1);
/* for a visual touch */
- TextOut( hdc, 0,10, "0123456789", 10);
+ TextOutA( hdc, 0,10, "0123456789", 10);
ScrollDC( hdc, -10, -5, &rc, &cliprc, hrgn, &rcu);
if (winetest_debug > 0) dump_region(hrgn);
/* create a region with what is expected */
hwnd2 = CreateWindowExA(0, "static", NULL,
WS_CHILD| WS_VISIBLE | WS_BORDER ,
50, 50, 100, 100, hwnd1, 0, 0, NULL);
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPSIBLINGS);
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPSIBLINGS);
GetClientRect( hwnd1, &rc);
cliprc=rc;
/* WS_CLIPCHILDREN and SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu,
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_SCROLLCHILDREN | SW_INVALIDATE);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* no SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_INVALIDATE);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* WS_CLIPCHILDREN and no SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_INVALIDATE);
if (pGetMonitorInfoA)
{
SetLastError(0xdeadbeef);
- rc = GetWindowText(hwndMain2, NULL, 1024);
+ rc = GetWindowTextA(hwndMain2, NULL, 1024);
ok( rc==0, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
}
else
}
SetLastError(0xdeadbeef);
- hwnd=CreateWindow("LISTBOX", "TestList",
+ hwnd=CreateWindowA("LISTBOX", "TestList",
(LBS_STANDARD & ~LBS_SORT),
0, 0, 100, 100,
NULL, (HMENU)1, NULL, 0);
{
HWND hwnd = 0;
- hwnd = CreateWindowEx(exStyle, class, class, style,
+ hwnd = CreateWindowExA(exStyle, class, class, style,
110, 100,
225, 200,
0,
static BOOL AWR_init(void)
{
- WNDCLASS class;
+ WNDCLASSA class;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = DefWindowProcA;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
class.hInstance = 0;
- class.hIcon = LoadIcon (0, IDI_APPLICATION);
- class.hCursor = LoadCursor (0, IDC_ARROW);
+ class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
class.hbrBackground = 0;
class.lpszMenuName = 0;
class.lpszClassName = szAWRClass;
-
- if (!RegisterClass (&class)) {
+
+ if (!RegisterClassA(&class)) {
ok(FALSE, "RegisterClass failed\n");
return FALSE;
}
if (!hmenu)
return FALSE;
ok(hmenu != 0, "Failed to create menu\n");
- ok(AppendMenu(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n");
-
+ ok(AppendMenuA(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n");
+
return TRUE;
}
}
return 0;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
/* Ensure we exit from RedrawNow regardless of invalidated area */
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "RedrawWindowClass";
EndPaint(hwnd, &ps);
return 0;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void zero_parentdc_stat(struct parentdc_stat *t)
clsMain.cbWndExtra = 0;
clsMain.hInstance = GetModuleHandleA(0);
clsMain.hIcon = 0;
- clsMain.hCursor = LoadCursorA(0, IDC_ARROW);
+ clsMain.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
clsMain.hbrBackground = GetStockObject(WHITE_BRUSH);
clsMain.lpszMenuName = NULL;
clsMain.lpszClassName = "ParentDcMainWindowClass";
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "ParentDcWindowClass";
MINMAXINFO *minmax;
if (msg != WM_GETMINMAXINFO)
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
minmax = (MINMAXINFO *)lp;
- if ((GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD))
+ if ((GetWindowLongA(hwnd, GWL_STYLE) & WS_CHILD))
{
minmax->ptReserved.x = 0;
minmax->ptReserved.y = 0;
minmax->ptMinTrackSize.y = 100;
}
else
- DefWindowProc(hwnd, msg, wp, lp);
+ DefWindowProcA(hwnd, msg, wp, lp);
return 1;
}
GetWindowRect( hwnd, &rect );
ok( !rect.left && !rect.top && !rect.right && !rect.bottom,
"wrong rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
case WM_NCCREATE:
case WM_CREATE:
"wrong rect %d,%d-%d,%d / %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom,
expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
case WM_NCCALCSIZE:
{
ok( !memcmp( &rect, r, sizeof(rect) ),
"passed rect %d,%d-%d,%d doesn't match window rect %d,%d-%d,%d\n",
r->left, r->top, r->right, r->bottom, rect.left, rect.top, rect.right, rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
default:
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
}
static void test_CreateWindow(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND hwnd, parent;
HMENU hmenu;
RECT rc, rc_minmax;
ok(res, "GetMenu error %d\n", GetLastError())
#define expect_style(window, style)\
- ok((ULONG)GetWindowLong(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLong(window, GWL_STYLE))
+ ok((ULONG)GetWindowLongA(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLongA(window, GWL_STYLE))
#define expect_ex_style(window, ex_style)\
- ok((ULONG)GetWindowLong(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLong(window, GWL_EXSTYLE))
+ ok((ULONG)GetWindowLongA(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLongA(window, GWL_EXSTYLE))
#define expect_gle_broken_9x(gle)\
ok(GetLastError() == gle ||\
/* WS_CHILD */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
/* WS_POPUP */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
/* WS_CHILD | WS_POPUP */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
cls.lpfnWndProc = minmax_wnd_proc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MinMax_WndClass";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
SetLastError(0xdeadbeef);
- parent = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ parent = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
0, 0, 100, 100, 0, 0, 0, NULL);
ok(parent != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(parent, 0);
expect_ex_style(parent, WS_EX_WINDOWEDGE);
memset(&minmax, 0, sizeof(minmax));
- SendMessage(parent, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
+ SendMessageA(parent, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
SetRect(&rc_minmax, 0, 0, minmax.ptMaxSize.x, minmax.ptMaxSize.y);
ok(IsRectEmpty(&rc_minmax), "ptMaxSize is not empty\n");
SetRect(&rc_minmax, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y);
trace("creating child with rect (%d,%d-%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ hwnd = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_ex_style(hwnd, WS_EX_WINDOWEDGE);
memset(&minmax, 0, sizeof(minmax));
- SendMessage(hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
+ SendMessageA(hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
SetRect(&rc_minmax, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y);
GetWindowRect(hwnd, &rc);
cls.lpfnWndProc = winsizes_wnd_proc;
cls.lpszClassName = "Sizes_WndClass";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
expected_cx = expected_cy = 200000;
SetRect( &expected_rect, 0, 0, 200000, 200000 );
/* we need a parent at 0,0 so that child coordinates match */
DestroyWindow(parent);
- parent = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
+ parent = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
ok(parent != 0, "CreateWindowEx error %d\n", GetLastError());
expected_cx = 100;
ReleaseDC( parent, hdc );
DestroyWindow( parent );
SetLastError( 0xdeadbeef );
- parent = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_LAYOUTRTL, "static", NULL, WS_POPUP,
+ parent = CreateWindowExA(WS_EX_APPWINDOW | WS_EX_LAYOUTRTL, "static", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, 0, NULL);
ok( parent != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( parent, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
res = pGetProcessDefaultLayout( &layout );
ok( res, "GetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( layout == LAYOUT_RTL, "GetProcessDefaultLayout wrong layout %x\n", layout );
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
DestroyWindow( hwnd );
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW );
DestroyWindow(parent);
- UnregisterClass("MinMax_WndClass", GetModuleHandle(0));
- UnregisterClass("Sizes_WndClass", GetModuleHandle(0));
+ UnregisterClassA("MinMax_WndClass", GetModuleHandleA(NULL));
+ UnregisterClassA("Sizes_WndClass", GetModuleHandleA(NULL));
#undef expect_gle_broken_9x
#undef expect_menu
WNDPROC old_window_procW;
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(NULL, GWLP_WNDPROC, 0);
+ retval = SetWindowLongPtrA(NULL, GWLP_WNDPROC, 0);
ok(!retval, "SetWindowLongPtr on invalid window handle should have returned 0 instead of 0x%lx\n", retval);
ok(check_error(GetLastError(), ERROR_INVALID_WINDOW_HANDLE),
"SetWindowLongPtr should have set error to ERROR_INVALID_WINDOW_HANDLE instead of %d\n", GetLastError());
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(hwndMain, 0xdeadbeef, 0);
+ retval = SetWindowLongPtrA(hwndMain, 0xdeadbeef, 0);
ok(!retval, "SetWindowLongPtr on invalid index should have returned 0 instead of 0x%lx\n", retval);
ok(check_error(GetLastError(), ERROR_INVALID_INDEX),
"SetWindowLongPtr should have set error to ERROR_INVALID_INDEX instead of %d\n", GetLastError());
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(hwndMain, GWLP_WNDPROC, 0);
+ retval = SetWindowLongPtrA(hwndMain, GWLP_WNDPROC, 0);
ok((WNDPROC)retval == main_window_procA || broken(!retval), /* win9x */
"SetWindowLongPtr on invalid window proc should have returned address of main_window_procA instead of 0x%lx\n", retval);
ok(GetLastError() == 0xdeadbeef, "SetWindowLongPtr shouldn't have set the last error, instead of setting it to %d\n", GetLastError());
- retval = GetWindowLongPtr(hwndMain, GWLP_WNDPROC);
+ retval = GetWindowLongPtrA(hwndMain, GWLP_WNDPROC);
ok((WNDPROC)retval == main_window_procA,
"SetWindowLongPtr on invalid window proc shouldn't have changed the value returned by GetWindowLongPtr, instead of changing it to 0x%lx\n", retval);
ok(!IsWindowUnicode(hwndMain), "hwndMain shouldn't be Unicode\n");
ok(IsWindowUnicode(hwndMain), "hwndMain should now be Unicode\n");
/* set it back to ANSI */
- SetWindowLongPtr(hwndMain, GWLP_WNDPROC, 0);
+ SetWindowLongPtrA(hwndMain, GWLP_WNDPROC, 0);
}
}
SetRect(&rcMain, 120, 120, 210, 210);
- hwnd = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd = CreateWindowExA(0, "MainWindowClass", NULL,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_POPUP,
rcMain.left, rcMain.top,
0, 0, 0, NULL);
assert(hwnd);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(!(style & WS_VISIBLE), "window should not be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_SHOW);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
ShowWindow(hwnd, SW_RESTORE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = EnableWindow(hwnd, FALSE);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom,
rc.left, rc.top, rc.right, rc.bottom);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
GetWindowRect(hwnd, &rc);
ok(!EqualRect(&rcMain, &rc), "rects shouldn't match\n");
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
ret = ShowWindow(hwnd, SW_RESTORE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom,
rc.left, rc.top, rc.right, rc.bottom);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
ok(IsWindow(hwnd), "window should exist\n");
ret = EnableWindow(hwnd, TRUE);
ok(ret, "not expected ret: %lu\n", ret);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
ok(!IsWindow(hwnd), "window should not exist\n");
}
static void test_gettext(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
LPCSTR clsname = "gettexttest";
HWND hwnd;
LRESULT r;
memset( &cls, 0, sizeof cls );
- cls.lpfnWndProc = DefWindowProc;
+ cls.lpfnWndProc = DefWindowProcA;
cls.lpszClassName = clsname;
- cls.hInstance = GetModuleHandle(NULL);
+ cls.hInstance = GetModuleHandleA(NULL);
- if (!RegisterClass( &cls )) return;
+ if (!RegisterClassA( &cls )) return;
- hwnd = CreateWindow( clsname, "test text", WS_OVERLAPPED, 0, 0, 10, 10, 0, NULL, NULL, NULL);
+ hwnd = CreateWindowA( clsname, "test text", WS_OVERLAPPED, 0, 0, 10, 10, 0, NULL, NULL, NULL);
ok( hwnd != NULL, "window was null\n");
- r = SendMessage( hwnd, WM_GETTEXT, 0x10, 0x1000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x10, 0x1000);
ok( r == 0, "settext should return zero\n");
- r = SendMessage( hwnd, WM_GETTEXT, 0x10000, 0);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x10000, 0);
ok( r == 0, "settext should return zero (%ld)\n", r);
- r = SendMessage( hwnd, WM_GETTEXT, 0xff000000, 0x1000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0xff000000, 0x1000);
ok( r == 0, "settext should return zero (%ld)\n", r);
- r = SendMessage( hwnd, WM_GETTEXT, 0x1000, 0xff000000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x1000, 0xff000000);
ok( r == 0, "settext should return zero (%ld)\n", r);
DestroyWindow(hwnd);
- UnregisterClass( clsname, NULL );
+ UnregisterClassA( clsname, NULL );
}
parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT)
{
if (msg.hwnd == hgrandparent) grandparent_wm_paint = TRUE;
if (msg.hwnd == hparent) parent_wm_paint = TRUE;
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(parent_wm_paint, "WM_PAINT should have been received in parent\n");
ok(!grandparent_wm_paint, "WM_PAINT should NOT have been received in grandparent\n");
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = classNameA;
parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT)
{
if (msg.hwnd == hgrandparent) grandparent_wm_paint = TRUE;
if (msg.hwnd == hparent) parent_wm_paint = TRUE;
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(parent_wm_paint, "WM_PAINT should have been received in parent\n");
ok(!grandparent_wm_paint, "WM_PAINT should NOT have been received in grandparent\n");
return 1;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void test_Expose(void)
switch(msg)
{
case WM_CREATE:
- ncredrawflags = *(UINT *) (((CREATESTRUCT *)lParam)->lpCreateParams);
+ ncredrawflags = *(UINT *) (((CREATESTRUCTA *)lParam)->lpCreateParams);
return 0;
case WM_NCPAINT:
RedrawWindow(hwnd, NULL, NULL, ncredrawflags);
EndPaint(hwnd, &ps);
return 0;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void run_NCRedrawLoop(UINT flags)
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
flush_events( FALSE );
- while(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE) != 0)
+ while (PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT) loopcount++;
if (loopcount >= 100) break;
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT);
}
if (flags == (RDW_INVALIDATE | RDW_FRAME))
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = 0;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ wndclass.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0,0,0,0, 0, 0, 0, NULL);
assert(hwnd);
- hinst = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
- ok(hinst == 0 || broken(hinst == GetModuleHandle(0)), /* win9x */ "expected 0, got %p\n", hinst);
+ hinst = (HINSTANCE)GetWindowLongPtrA(hwnd, GWLP_HINSTANCE);
+ ok(hinst == 0 || broken(hinst == GetModuleHandleA(NULL)), /* win9x */ "expected 0, got %p\n", hinst);
buf1[0] = 0;
SetLastError(0xdeadbeef);
- ret1 = GetModuleFileName(hinst, buf1, sizeof(buf1));
+ ret1 = GetModuleFileNameA(hinst, buf1, sizeof(buf1));
ok(ret1, "GetModuleFileName error %u\n", GetLastError());
buf2[0] = 0;
ok(ret1 == ret2 || broken(ret2 == ret1 + 1), /* win98 */ "%u != %u\n", ret1, ret2);
ok(!strcmp(buf1, buf2), "%s != %s\n", buf1, buf2);
}
- hinst = GetModuleHandle(0);
+ hinst = GetModuleHandleA(NULL);
SetLastError(0xdeadbeef);
- ret2 = GetModuleFileName(hinst, buf2, ret1 - 2);
+ ret2 = GetModuleFileNameA(hinst, buf2, ret1 - 2);
ok(ret2 == ret1 - 2 || broken(ret2 == ret1 - 3), /* win98 */
"expected %u, got %u\n", ret1 - 2, ret2);
ok(GetLastError() == 0xdeadbeef /* XP */ ||
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
- ret2 = GetModuleFileName(hinst, buf2, 0);
+ ret2 = GetModuleFileNameA(hinst, buf2, 0);
ok(!ret2, "GetModuleFileName should return 0\n");
ok(GetLastError() == 0xdeadbeef /* XP */ ||
GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef), /* win9x */
"expected ERROR_INVALID_WINDOW_HANDLE, got %u\n", GetLastError());
- hwnd = FindWindow("Shell_TrayWnd", NULL);
+ hwnd = FindWindowA("Shell_TrayWnd", NULL);
ok(IsWindow(hwnd) || broken(!hwnd), "got invalid tray window %p\n", hwnd);
SetLastError(0xdeadbeef);
ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1));
if (!ret1) /* inter-process GetWindowModuleFileName works on win9x, so don't test the desktop there */
{
- ret1 = GetModuleFileName(0, buf1, sizeof(buf1));
+ ret1 = GetModuleFileNameA(0, buf1, sizeof(buf1));
hwnd = GetDesktopWindow();
ok(IsWindow(hwnd), "got invalid desktop window %p\n", hwnd);
SetLastError(0xdeadbeef);
"parent shouldn't have parent %p\n", pGetAncestor(parent, GA_PARENT) );
trace("parent %p root %p desktop %p\n", parent, root, desktop);
if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0;
- ok( !lstrcmpi( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
+ ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
GetWindowRect( parent, &rect );
ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
"wrong parent rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
ok( !ret, "GetLayeredWindowAttributes should fail on non-layered window\n" );
ret = pSetLayeredWindowAttributes( hwnd, 0, 0, LWA_ALPHA );
ok( !ret, "SetLayeredWindowAttributes should fail on non-layered window\n" );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
/* clearing WS_EX_LAYERED resets attributes */
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
SetLastError( 0xdeadbeef );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on no longer layered window\n" );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( flags == 0, "wrong flags %x\n", flags );
/* default alpha and color key is 0 */
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pSetLayeredWindowAttributes( hwnd, 0x222222, 55, 0 );
ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
case WM_NCCREATE:
{
CREATESTRUCTA *cs = (CREATESTRUCTA *)lp;
- trace("WM_NCCREATE: rect %d,%d-%d,%d\n", cs->x, cs->y, cs->cx, cs->cy);
ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top &&
cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom,
"expected %d,%d-%d,%d, got %d,%d-%d,%d\n",
case WM_GETMINMAXINFO:
{
MINMAXINFO *minmax = (MINMAXINFO *)lp;
- dump_minmax_info(minmax);
ok(minmax->ptMaxPosition.x <= mi.rcMonitor.left, "%d <= %d\n", minmax->ptMaxPosition.x, mi.rcMonitor.left);
ok(minmax->ptMaxPosition.y <= mi.rcMonitor.top, "%d <= %d\n", minmax->ptMaxPosition.y, mi.rcMonitor.top);
ok(minmax->ptMaxSize.x >= mi.rcMonitor.right, "%d >= %d\n", minmax->ptMaxSize.x, mi.rcMonitor.right);
break;
}
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void test_fullscreen(void)
static const DWORD t_ex_style[] = {
0, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW
};
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND hwnd;
int i, j;
POINT pt;
cls.lpfnWndProc = fullscreen_wnd_proc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "fullscreen_class";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
for (i = 0; i < sizeof(t_style)/sizeof(t_style[0]); i++)
{
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
}
}
- UnregisterClass("fullscreen_class", GetModuleHandle(0));
+ UnregisterClassA("fullscreen_class", GetModuleHandleA(NULL));
}
static BOOL test_thick_child_got_minmax;
LONG expectedWidth;
LONG expectedHeight;
WNDCLASSA cls;
- LPCTSTR className = "THICK_CHILD_CLASS";
+ static const char className[] = "THICK_CHILD_CLASS";
int i;
LONG adjustedStyle;
static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = {
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = className;
test_thick_child_got_minmax = FALSE;
SetLastError(0xdeadbeef);
- childWindow = CreateWindowEx( exStyles[i], className, "", styles[i], 0, 0, 0, 0, parentWindow, 0, GetModuleHandleA(0), NULL );
+ childWindow = CreateWindowExA( exStyles[i], className, "", styles[i], 0, 0, 0, 0, parentWindow, 0, GetModuleHandleA(0), NULL );
ok(childWindow != NULL, "Failed to create child window, error: %u\n", GetLastError());
ok(test_thick_child_got_minmax, "Got no WM_GETMINMAXINFO\n");
success = DestroyWindow(childWindow);
ok(success,"DestroyWindow call failed, error: %u\n", GetLastError());
}
- ok(UnregisterClass(className, GetModuleHandleA(0)),"UnregisterClass call failed\n");
+ ok(UnregisterClassA(className, GetModuleHandleA(NULL)),"UnregisterClass call failed\n");
}
static void test_handles( HWND full_hwnd )
hwndOwner = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- NULL, 0, GetModuleHandle(0), NULL);
+ NULL, 0, GetModuleHandleA(NULL), NULL);
hwndPopup1 = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- hwndOwner, 0, GetModuleHandle(0), NULL);
+ hwndOwner, 0, GetModuleHandleA(NULL), NULL);
hwndPopup2 = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- hwndPopup1, 0, GetModuleHandle(0), NULL);
+ hwndPopup1, 0, GetModuleHandleA(NULL), NULL);
ok( GetLastActivePopup(hwndOwner) == hwndPopup2, "wrong last active popup\n" );
DestroyWindow( hwndPopup2 );
DestroyWindow( hwndPopup1 );
static LRESULT WINAPI my_httrasparent_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
if (msg == WM_NCHITTEST) return HTTRANSPARENT;
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static LRESULT WINAPI my_window_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void create_window_tree(HWND parent, HWND *window, int size)
for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
{
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_window", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "my_window", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_window", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_window", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_httrasparent", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "my_httrasparent", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(0, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Static", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "Static", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Static", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Static", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
struct window_attributes
{
char class_name[128];
- int is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent;
+ BOOL is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent;
};
static void get_window_attributes(HWND hwnd, struct window_attributes *attrs)
{
DWORD style, ex_style, hittest;
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
attrs->class_name[0] = 0;
- GetClassName(hwnd, attrs->class_name, sizeof(attrs->class_name));
- hittest = SendMessage(hwnd, WM_NCHITTEST, 0, 0);
+ GetClassNameA(hwnd, attrs->class_name, sizeof(attrs->class_name));
+ hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, 0);
attrs->is_visible = (style & WS_VISIBLE) != 0;
attrs->is_enabled = (style & WS_DISABLED) == 0;
- attrs->is_groupbox = !lstrcmpi(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
+ attrs->is_groupbox = !lstrcmpiA(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
attrs->is_httransparent = hittest == HTTRANSPARENT;
attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0;
}
int found_invisible, found_disabled, found_groupbox, found_httransparent, found_extransparent;
int ret, i;
- ret = GetClassInfo(0, "Button", &cls);
+ ret = GetClassInfoA(0, "Button", &cls);
ok(ret, "GetClassInfo(Button) failed\n");
cls.lpszClassName = "my_button";
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_button) failed\n");
cls.lpszClassName = "my_httrasparent";
cls.lpfnWndProc = my_httrasparent_proc;
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_httrasparent) failed\n");
cls.lpszClassName = "my_window";
cls.lpfnWndProc = my_window_proc;
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_window) failed\n");
- parent = CreateWindowEx(0, "MainWindowClass", NULL,
+ parent = CreateWindowExA(0, "MainWindowClass", NULL,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE,
100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
ok(parent != 0, "CreateWindowEx failed\n");
trace("parent %p\n", parent);
todo_wine
ok(found_extransparent, "found %d extransparent windows\n", found_extransparent);
- ret = UnregisterClass("my_button", cls.hInstance);
+ ret = UnregisterClassA("my_button", cls.hInstance);
ok(ret, "UnregisterClass(my_button) failed\n");
- ret = UnregisterClass("my_httrasparent", cls.hInstance);
+ ret = UnregisterClassA("my_httrasparent", cls.hInstance);
ok(ret, "UnregisterClass(my_httrasparent) failed\n");
- ret = UnregisterClass("my_window", cls.hInstance);
+ ret = UnregisterClassA("my_window", cls.hInstance);
ok(ret, "UnregisterClass(my_window) failed\n");
}
RECT client_rect;
/* Create test windows */
- wnd = CreateWindow("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
+ wnd = CreateWindowA("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
ok(wnd != NULL, "Failed %p\n", wnd);
- wnd0 = CreateWindow("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
+ wnd0 = CreateWindowA("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
ok(wnd0 != NULL, "Failed %p\n", wnd);
- dwnd = CreateWindow("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
+ dwnd = CreateWindowA("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
DestroyWindow(dwnd);
ok(dwnd != NULL, "Failed %p\n", dwnd);
DestroyWindow(wnd0);
}
+static void test_update_region(void)
+{
+ HWND hwnd, parent, child;
+ HRGN rgn1, rgn2;
+ const RECT rc = {15, 15, 40, 40};
+ const POINT wnd_orig = {30, 20};
+ const POINT child_orig = {10, 5};
+
+ parent = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_CLIPCHILDREN,
+ 0, 0, 300, 150, NULL, NULL, GetModuleHandleA(0), 0);
+ hwnd = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD,
+ 0, 0, 200, 100, parent, NULL, GetModuleHandleA(0), 0);
+ child = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_CHILD,
+ child_orig.x, child_orig.y, 100, 50,
+ hwnd, NULL, GetModuleHandleA(0), 0);
+ assert(parent && hwnd && child);
+
+ ValidateRgn(parent, NULL);
+ ValidateRgn(hwnd, NULL);
+ InvalidateRect(hwnd, &rc, FALSE);
+ ValidateRgn(child, NULL);
+
+ rgn1 = CreateRectRgn(0, 0, 0, 0);
+ ok(GetUpdateRgn(parent, rgn1, FALSE) == NULLREGION,
+ "has invalid area after ValidateRgn(NULL)\n");
+ GetUpdateRgn(hwnd, rgn1, FALSE);
+ rgn2 = CreateRectRgnIndirect(&rc);
+ ok(EqualRgn(rgn1, rgn2), "assigned and retrieved update regions are different\n");
+ ok(GetUpdateRgn(child, rgn2, FALSE) == NULLREGION,
+ "has invalid area after ValidateRgn(NULL)\n");
+
+ SetWindowPos(hwnd, 0, wnd_orig.x, wnd_orig.y, 0, 0,
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+
+ /* parent now has non-simple update region, it consist of
+ * two rects, that was exposed after hwnd moving ... */
+ SetRectRgn(rgn1, 0, 0, 200, wnd_orig.y);
+ SetRectRgn(rgn2, 0, 0, wnd_orig.x, 100);
+ CombineRgn(rgn1, rgn1, rgn2, RGN_OR);
+ /* ... and mapped hwnd's invalid area, that hwnd has before moving */
+ SetRectRgn(rgn2, rc.left + wnd_orig.x, rc.top + wnd_orig.y,
+ rc.right + wnd_orig.x, rc.bottom + wnd_orig.y);
+ CombineRgn(rgn1, rgn1, rgn2, RGN_OR);
+ GetUpdateRgn(parent, rgn2, FALSE);
+todo_wine
+ ok(EqualRgn(rgn1, rgn2), "wrong update region\n");
+
+ /* hwnd has the same invalid region as before moving */
+ SetRectRgn(rgn1, rc.left, rc.top, rc.right, rc.bottom);
+ GetUpdateRgn(hwnd, rgn2, FALSE);
+ ok(EqualRgn(rgn1, rgn2), "wrong update region\n");
+
+ /* hwnd's invalid area maps to child during moving */
+ SetRectRgn(rgn1, rc.left - child_orig.x , rc.top - child_orig.y,
+ rc.right - child_orig.x, rc.bottom - child_orig.y);
+ GetUpdateRgn(child, rgn2, FALSE);
+todo_wine
+ ok(EqualRgn(rgn1, rgn2), "wrong update region\n");
+
+ DeleteObject(rgn1);
+ DeleteObject(rgn2);
+ DestroyWindow(parent);
+}
+
+static void test_window_without_child_style(void)
+{
+ HWND hwnd;
+
+ hwnd = CreateWindowExA(0, "edit", NULL, WS_VISIBLE|WS_CHILD,
+ 0, 0, 50, 50, hwndMain, NULL, 0, NULL);
+ ok(hwnd != NULL, "CreateWindow failed\n");
+
+ ok(SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & (~WS_CHILD)),
+ "can't remove WS_CHILD style\n");
+
+ SetActiveWindow(hwndMain);
+ PostMessageW(hwnd, WM_LBUTTONUP, 0, 0);
+ SendMessageW(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
+ check_active_state(hwnd, hwnd, hwnd);
+ flush_events(TRUE);
+
+ DestroyWindow(hwnd);
+}
+
+
+struct smresult_thread_data
+{
+ HWND main_hwnd;
+ HWND thread_hwnd;
+ HANDLE thread_started;
+ HANDLE thread_got_wm_app;
+ HANDLE main_in_wm_app_1;
+ HANDLE thread_replied;
+};
+
+
+static LRESULT WINAPI smresult_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch (msg)
+ {
+ case WM_APP:
+ {
+ struct smresult_thread_data *data = (struct smresult_thread_data*)lparam;
+
+ ok(hwnd == data->thread_hwnd, "unexpected hwnd %p\n", hwnd);
+
+ SendNotifyMessageA(data->main_hwnd, WM_APP+1, 0, lparam);
+
+ /* Don't return until the main thread is processing our sent message. */
+ ok(WaitForSingleObject(data->main_in_wm_app_1, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+
+ /* Break the PeekMessage loop so we can notify the main thread after we return. */
+ SetEvent(data->thread_got_wm_app);
+
+ return 0x240408ea;
+ }
+ case WM_APP+1:
+ {
+ struct smresult_thread_data *data = (struct smresult_thread_data*)lparam;
+ LRESULT res;
+
+ ok(hwnd == data->main_hwnd, "unexpected hwnd %p\n", hwnd);
+
+ /* Ask the thread to reply to our WM_APP message. */
+ SetEvent(data->main_in_wm_app_1);
+
+ /* Wait until the thread has sent a reply. */
+ ok(WaitForSingleObject(data->thread_replied, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+
+ /* Send another message while we have a reply queued for the current one. */
+ res = SendMessageA(data->thread_hwnd, WM_APP+2, 0, lparam);
+ ok(res == 0x449b0190, "unexpected result %lx\n", res);
+
+ return 0;
+ }
+ case WM_APP+2:
+ {
+ struct smresult_thread_data *data = (struct smresult_thread_data*)lparam;
+
+ ok(hwnd == data->thread_hwnd, "unexpected hwnd %p\n", hwnd);
+
+ /* Don't return until we know the main thread is processing sent messages. */
+ SendMessageA(data->main_hwnd, WM_NULL, 0, 0);
+
+ return 0x449b0190;
+ }
+ case WM_CLOSE:
+ PostQuitMessage(0);
+ break;
+ }
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
+}
+
+static DWORD WINAPI smresult_thread_proc(void *param)
+{
+ MSG msg;
+ struct smresult_thread_data *data = param;
+
+ data->thread_hwnd = CreateWindowExA(0, "SmresultClass", "window caption text", WS_OVERLAPPEDWINDOW,
+ 100, 100, 200, 200, 0, 0, 0, NULL);
+ ok(data->thread_hwnd != 0, "Failed to create overlapped window\n");
+
+ SetEvent(data->thread_started);
+
+ /* Loop until we've processed WM_APP. */
+ while (WaitForSingleObject(data->thread_got_wm_app, 0) != WAIT_OBJECT_0)
+ {
+ if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ }
+ else
+ {
+ MsgWaitForMultipleObjects(1, &data->thread_got_wm_app, FALSE, INFINITE, QS_SENDMESSAGE);
+ }
+ }
+
+ /* Notify the main thread that we replied to its WM_APP message. */
+ SetEvent(data->thread_replied);
+
+ while (GetMessageA(&msg, 0, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ }
+
+ return 0;
+}
+
+static void test_smresult(void)
+{
+ WNDCLASSA cls;
+ HANDLE hThread;
+ DWORD tid;
+ struct smresult_thread_data data;
+ BOOL ret;
+ LRESULT res;
+
+ cls.style = CS_DBLCLKS;
+ cls.lpfnWndProc = smresult_wndproc;
+ cls.cbClsExtra = 0;
+ cls.cbWndExtra = 0;
+ cls.hInstance = GetModuleHandleA(0);
+ cls.hIcon = 0;
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
+ cls.hbrBackground = GetStockObject(WHITE_BRUSH);
+ cls.lpszMenuName = NULL;
+ cls.lpszClassName = "SmresultClass";
+
+ ret = RegisterClassA(&cls);
+ ok(ret, "RegisterClassA failed\n");
+
+ data.thread_started = CreateEventA(NULL, TRUE, FALSE, NULL);
+ ok(data.thread_started != NULL, "CreateEventA failed\n");
+
+ data.thread_got_wm_app = CreateEventA(NULL, TRUE, FALSE, NULL);
+ ok(data.thread_got_wm_app != NULL, "CreateEventA failed\n");
+
+ data.main_in_wm_app_1 = CreateEventA(NULL, TRUE, FALSE, NULL);
+ ok(data.main_in_wm_app_1 != NULL, "CreateEventA failed\n");
+
+ data.thread_replied = CreateEventA(NULL, TRUE, FALSE, NULL);
+ ok(data.thread_replied != NULL, "CreateEventA failed\n");
+
+ data.main_hwnd = CreateWindowExA(0, "SmresultClass", "window caption text", WS_OVERLAPPEDWINDOW,
+ 100, 100, 200, 200, 0, 0, 0, NULL);
+
+ hThread = CreateThread(NULL, 0, smresult_thread_proc, &data, 0, &tid);
+ ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+
+ ok(WaitForSingleObject(data.thread_started, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+
+ res = SendMessageA(data.thread_hwnd, WM_APP, 0, (LPARAM)&data);
+ ok(res == 0x240408ea, "unexpected result %lx\n", res);
+
+ SendMessageA(data.thread_hwnd, WM_CLOSE, 0, 0);
+
+ DestroyWindow(data.main_hwnd);
+
+ ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+
+ CloseHandle(data.thread_started);
+ CloseHandle(data.thread_got_wm_app);
+ CloseHandle(data.main_in_wm_app_1);
+ CloseHandle(data.thread_replied);
+}
+
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
if (!RegisterWindowClasses()) assert(0);
+ hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
+ WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
+ WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE,
+ 100, 100, 200, 200,
+ 0, 0, GetModuleHandleA(NULL), NULL);
+ assert( hwndMain );
+
+ if(!SetForegroundWindow(hwndMain)) {
+ /* workaround for foreground lock timeout */
+ INPUT input[2];
+ UINT events_no;
+
+ memset(input, 0, sizeof(input));
+ input[0].type = INPUT_MOUSE;
+ U(input[0]).mi.dx = 101;
+ U(input[0]).mi.dy = 101;
+ U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
+ input[0].type = INPUT_MOUSE;
+ U(input[0]).mi.dx = 101;
+ U(input[0]).mi.dy = 101;
+ U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTUP;
+ events_no = SendInput(2, input, sizeof(input[0]));
+ ok(events_no == 2, "SendInput returned %d\n", events_no);
+ ok(SetForegroundWindow(hwndMain), "SetForegroundWindow failed\n");
+ }
+
SetLastError(0xdeafbeef);
GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC);
is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED);
test_FindWindowEx();
test_SetParent();
- hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
- WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
- WS_MAXIMIZEBOX | WS_POPUP,
- 100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2",
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_POPUP,
100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
- assert( hwndMain );
+ 0, 0, GetModuleHandleA(NULL), NULL);
assert( hwndMain2 );
our_pid = GetWindowThreadProcessId(hwndMain, NULL);
test_SetForegroundWindow(hwndMain);
if(!winetest_interactive)
- skip("bug 5957: skipping test_shell_window, it crashes ros/win7 explorer\n");
+ skip("bug ROSTESTS-23: skipping test_shell_window, it crashes ros/win7 explorer\n");
else
test_shell_window();
test_handles( hwndMain );
test_winregion();
test_map_points();
+ test_update_region();
+ test_window_without_child_style();
+ test_smresult();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);