*/
/* To get ICON_SMALL2 with the MSVC headers */
-#define _WIN32_WINNT 0x0501
+//#define _WIN32_WINNT 0x0501
#include <assert.h>
#include <stdlib.h>
static UINT (WINAPI *pGetWindowModuleFileNameA)(HWND,LPSTR,UINT);
static BOOL (WINAPI *pGetLayeredWindowAttributes)(HWND,COLORREF*,BYTE*,DWORD*);
static BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
+static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
+static BOOL (WINAPI *pUpdateLayeredWindowIndirect)(HWND,const UPDATELAYEREDWINDOWINFO*);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*);
+static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout );
+static BOOL (WINAPI *pSetProcessDefaultLayout)( DWORD layout );
+static BOOL (WINAPI *pFlashWindowEx)( PFLASHWINFO pfwi );
+static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
+static DWORD (WINAPI *pGetLayout)(HDC hdc);
+static BOOL (WINAPI *pMirrorRgn)(HWND hwnd, HRGN hrgn);
static BOOL test_lbuttondown_flag;
static HWND hwndMessage;
{
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;
}
}
}
+#define check_wnd_state(a,b,c,d) check_wnd_state_(__FILE__,__LINE__,a,b,c,d)
+static void check_wnd_state_(const char *file, int line,
+ HWND active, HWND foreground, HWND focus, HWND capture)
+{
+ ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
+ /* only check foreground if it belongs to the current thread */
+ /* foreground can be moved to a different app pretty much at any time */
+ if (foreground && GetForegroundWindow() &&
+ GetWindowThreadProcessId(GetForegroundWindow(), NULL) == GetCurrentThreadId())
+ ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
+ ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
+ ok_(file, line)(capture == GetCapture(), "GetCapture() = %p\n", GetCapture());
+}
+
+/* same as above but without capture test */
+#define check_active_state(a,b,c) check_active_state_(__FILE__,__LINE__,a,b,c)
+static void check_active_state_(const char *file, int line,
+ HWND active, HWND foreground, HWND focus)
+{
+ ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
+ /* only check foreground if it belongs to the current thread */
+ /* foreground can be moved to a different app pretty much at any time */
+ if (foreground && GetForegroundWindow() &&
+ GetWindowThreadProcessId(GetForegroundWindow(), NULL) == GetCurrentThreadId())
+ ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
+ ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
+}
+
static BOOL ignore_message( UINT message )
{
/* these are always ignored */
check_parents( test, desktop, 0, desktop, 0, test, desktop );
/* window is now child of desktop so GWLP_HWNDPARENT changes owner from now on */
+ if (!is_win9x)
+ {
+ ret = (HWND)SetWindowLongPtrA( test, GWLP_HWNDPARENT, (LONG_PTR)test );
+ ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret );
+ check_parents( test, desktop, 0, desktop, 0, test, desktop );
+ }
+ else
+ win_skip("Test creates circular window tree under Win9x/WinMe\n" );
+
ret = (HWND)SetWindowLongPtrA( test, GWLP_HWNDPARENT, (LONG_PTR)child );
ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret );
check_parents( test, desktop, child, desktop, child, test, desktop );
BOOL ret;
MSG msg;
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
+ if (pGetGUIThreadInfo)
+ {
+ GUITHREADINFO info;
+ info.cbSize = sizeof(info);
+ ret = pGetGUIThreadInfo( GetCurrentThreadId(), &info );
+ ok( ret || broken(!ret), /* win9x */
+ "GetGUIThreadInfo failed without message queue\n" );
+ SetLastError( 0xdeadbeef );
+ info.cbSize = sizeof(info) + 1;
+ ret = pGetGUIThreadInfo( GetCurrentThreadId(), &info );
+ ok( !ret, "GetGUIThreadInfo succeeded with wrong size\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER ||
+ broken(GetLastError() == 0xdeadbeef), /* win9x */
+ "wrong error %u\n", GetLastError() );
+ }
+
+ 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);
/* Win9x does not fixup cx/xy for WM_WINDOWPOSCHANGING */
if (!(winpos->flags & SWP_NOSIZE) && !is_win9x)
{
- ok(winpos->cx >= 0 && winpos->cx <= 32767, "bad winpos->cx %d\n", winpos->cx);
- ok(winpos->cy >= 0 && winpos->cy <= 32767, "bad winpos->cy %d\n", winpos->cy);
+ ok((winpos->cx >= 0 && winpos->cx <= 32767) ||
+ winpos->cx == 32768, /* win7 doesn't truncate */
+ "bad winpos->cx %d\n", winpos->cx);
+ ok((winpos->cy >= 0 && winpos->cy <= 32767) ||
+ winpos->cy == 40000, /* win7 doesn't truncate */
+ "bad winpos->cy %d\n", winpos->cy);
}
break;
}
{
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);
- ok(winpos->cx >= 0 && winpos->cx <= 32767, "bad winpos->cx %d\n", winpos->cx);
- ok(winpos->cy >= 0 && winpos->cy <= 32767, "bad winpos->cy %d\n", winpos->cy);
+ ok((winpos->cx >= 0 && winpos->cx <= 32767) ||
+ winpos->cx == 32768, /* win7 doesn't truncate */
+ "bad winpos->cx %d\n", winpos->cx);
+ ok((winpos->cy >= 0 && winpos->cy <= 32767) ||
+ winpos->cy == 40000, /* win7 doesn't truncate */
+ "bad winpos->cy %d\n", winpos->cy);
GetWindowRect(hwnd, &rc1);
SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
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 */ ||
RECT rc;
LONG style;
CBT_CREATEWNDA *createwnd = (CBT_CREATEWNDA *)lParam;
- trace("HCBT_CREATEWND: hwnd %p, parent %p, style %08x\n",
- hwnd, createwnd->lpcs->hwndParent, createwnd->lpcs->style);
ok(createwnd->hwndInsertAfter == HWND_TOP, "hwndInsertAfter should be always HWND_TOP\n");
if (pGetWindowInfo)
case HCBT_MOVESIZE:
case HCBT_MINMAX:
case HCBT_ACTIVATE:
- case HCBT_SETFOCUS:
if (pGetWindowInfo && IsWindow(hwnd))
{
WINDOWINFO info;
verify_window_info(code_name, hwnd, &info);
}
break;
- /* on HCBT_DESTROYWND window state is undefined */
+ /* window state is undefined */
+ case HCBT_SETFOCUS:
case HCBT_DESTROYWND:
- trace( "HCBT_DESTROYWND: hwnd %p\n", hwnd );
break;
default:
break;
}
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? TRUE: FALSE;
+ 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)
+static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
{
RECT orig_win_rc, rect;
LONG_PTR old_proc;
+ HWND hwnd_grandchild, hwnd_child, hwnd_child2;
+ HWND hwnd_desktop;
+ RECT rc1, rc2;
+ BOOL ret;
SetRect(&rect, 111, 222, 333, 444);
ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n");
GetWindowRect(hwnd, &orig_win_rc);
- old_proc = SetWindowLongPtr( hwnd, GWLP_WNDPROC, (ULONG_PTR)nccalcsize_proc );
- SetWindowPos(hwnd, 0, 100, 100, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
+ 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 );
ok( rect.left == 100 && rect.top == 100 && rect.right == 100 && rect.bottom == 100,
"invalid window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
ok( rect.left == 90 && rect.top == 90 && rect.right == 110 && rect.bottom == 110,
"invalid client rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
- SetWindowPos(hwnd, 0, 200, 200, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
+ ret = SetWindowPos(hwnd, 0, 200, 200, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
+ ok(ret, "Got %d\n", ret);
GetWindowRect( hwnd, &rect );
ok( rect.left == 200 && rect.top == 200 && rect.right == 200 && rect.bottom == 200,
"invalid window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
ok( rect.left == 210 && rect.top == 210 && rect.right == 190 && rect.bottom == 190,
"invalid client rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
- SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top,
- orig_win_rc.right, orig_win_rc.bottom, 0);
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, old_proc );
+ 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);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, old_proc );
/* Win9x truncates coordinates to 16-bit irrespectively */
if (!is_win9x)
{
- SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOMOVE);
- SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOMOVE);
-
- SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOSIZE);
- SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOSIZE);
+ ret = SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOMOVE);
+ ok(ret, "Got %d\n", ret);
+ ret = SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOMOVE);
+ ok(ret, "Got %d\n", ret);
+
+ ret = SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
+ ret = SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
}
- SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top,
- orig_win_rc.right, orig_win_rc.bottom, 0);
-
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
- SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
- SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+ 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);
+
+ 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(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(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(!(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());
+ hwnd_child = create_tool_window(WS_VISIBLE|WS_CHILD, hwnd);
+ ok(!!hwnd_child, "Failed to create child window (%d)\n", GetLastError());
+ hwnd_grandchild = create_tool_window(WS_VISIBLE|WS_CHILD, hwnd_child);
+ ok(!!hwnd_child, "Failed to create child window (%d)\n", GetLastError());
+ hwnd_child2 = create_tool_window(WS_VISIBLE|WS_CHILD, hwnd);
+ ok(!!hwnd_child2, "Failed to create second child window (%d)\n", GetLastError());
+
+ ret = SetWindowPos(hwnd, hwnd2, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
+ check_active_state(hwnd, hwnd, hwnd);
+
+ ret = SetWindowPos(hwnd2, hwnd, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Returns TRUE also for windows that are not siblings */
+ ret = SetWindowPos(hwnd_child, hwnd2, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ ret = SetWindowPos(hwnd2, hwnd_child, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Does not seem to do anything even without passing flags, still returns TRUE */
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, hwnd2 , 1, 2, 3, 4, 0);
+ ok(ret, "Got %d\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok(rc1.left == rc2.left && rc1.top == rc2.top &&
+ rc1.right == rc2.right && rc1.bottom == rc2.bottom,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Same thing the other way around. */
+ GetWindowRect(hwnd2, &rc1);
+ ret = SetWindowPos(hwnd2, hwnd_child, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d\n", ret);
+ GetWindowRect(hwnd2, &rc2);
+ ok(rc1.left == rc2.left && rc1.top == rc2.top &&
+ rc1.right == rc2.right && rc1.bottom == rc2.bottom,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* .. and with these windows. */
+ GetWindowRect(hwnd_grandchild, &rc1);
+ ret = SetWindowPos(hwnd_grandchild, hwnd_child2, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d\n", ret);
+ GetWindowRect(hwnd_grandchild, &rc2);
+ ok(rc1.left == rc2.left && rc1.top == rc2.top &&
+ rc1.right == rc2.right && rc1.bottom == rc2.bottom,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Add SWP_NOZORDER and it will be properly resized. */
+ GetWindowRect(hwnd_grandchild, &rc1);
+ ret = SetWindowPos(hwnd_grandchild, hwnd_child2, 1, 2, 3, 4, SWP_NOZORDER);
+ ok(ret, "Got %d\n", ret);
+ GetWindowRect(hwnd_grandchild, &rc2);
+ ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
+ (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Given a sibling window, the window is properly resized. */
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, hwnd_child2, 1, 2, 3, 4, 0);
+ ok(ret, "Got %d\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
+ (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ /* Involving the desktop window changes things. */
+ ret = SetWindowPos(hwnd_child, hwnd_desktop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(!ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ GetWindowRect(hwnd_child, &rc1);
+ ret = SetWindowPos(hwnd_child, hwnd_desktop, 0, 0, 0, 0, 0);
+ ok(!ret, "Got %d\n", ret);
+ GetWindowRect(hwnd_child, &rc2);
+ ok(rc1.top == rc2.top && rc1.left == rc2.left &&
+ rc1.bottom == rc2.bottom && rc1.right == rc2.right,
+ "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
+ rc1.top, rc1.left, rc1.bottom, rc1.right, rc2.top, rc2.left, rc2.bottom, rc2.right);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ ret = SetWindowPos(hwnd_desktop, hwnd_child, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(!ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ ret = SetWindowPos(hwnd_desktop, hwnd, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(!ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ ret = SetWindowPos(hwnd, hwnd_desktop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ ok(!ret, "Got %d\n", ret);
+ check_active_state(hwnd2, hwnd2, hwnd2);
+
+ DestroyWindow(hwnd_grandchild);
+ DestroyWindow(hwnd_child);
+ DestroyWindow(hwnd_child2);
+
+ hwnd_child = create_tool_window(WS_CHILD|WS_POPUP|WS_SYSMENU, hwnd2);
+ ok(!!hwnd_child, "Failed to create child window (%d)\n", GetLastError());
+ ret = SetWindowPos(hwnd_child, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
+ ok(ret, "Got %d\n", ret);
+ flush_events( TRUE );
+ todo_wine check_active_state(hwnd2, hwnd2, hwnd2);
+ DestroyWindow(hwnd_child);
}
static void test_SetMenu(HWND parent)
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)
{
- HWND child, child2;
+ HWND child, child2, ret;
WNDPROC old_wnd_proc;
/* check if we can set focus to non-visible windows */
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() );
+ SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
+ SetFocus( hwnd );
+ SetParent( child, GetDesktopWindow());
+ SetParent( child2, child );
+ ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
+ ok( GetFocus() == hwnd, "Focus should be on parent %p\n", hwnd );
+ ret = SetFocus( child2 );
+ ok( ret == 0, "SetFocus %p should fail\n", child2);
+ ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
+ ok( GetFocus() == hwnd, "Focus should be on parent %p\n", hwnd );
+ ret = SetFocus( child );
+ ok( ret == 0, "SetFocus %p should fail\n", child);
+ ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
+ ok( GetFocus() == hwnd, "Focus should be on parent %p\n", hwnd );
+ SetWindowLongW( child, GWL_STYLE, WS_POPUP|WS_CHILD );
+ SetFocus( child2 );
+ ok( GetActiveWindow() == child, "child window %p should be active\n", child);
+ ok( GetFocus() == child2, "Focus should be on child2 %p\n", child2 );
+ SetFocus( hwnd );
+ ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
+ ok( GetFocus() == hwnd, "Focus should be on parent %p\n", hwnd );
+ SetFocus( child );
+ ok( GetActiveWindow() == child, "child window %p should be active\n", child);
+ ok( GetFocus() == child, "Focus should be on child %p\n", child );
DestroyWindow( child2 );
DestroyWindow( child );
}
-#define check_wnd_state(a,b,c,d) check_wnd_state_(__FILE__,__LINE__,a,b,c,d)
-static void check_wnd_state_(const char *file, int line,
- HWND active, HWND foreground, HWND focus, HWND capture)
-{
- ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
- /* only check foreground if it belongs to the current thread */
- /* foreground can be moved to a different app pretty much at any time */
- if (foreground && GetForegroundWindow() &&
- GetWindowThreadProcessId(GetForegroundWindow(), NULL) == GetCurrentThreadId())
- ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
- ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
- ok_(file, line)(capture == GetCapture(), "GetCapture() = %p\n", GetCapture());
-}
-
static void test_SetActiveWindow(HWND hwnd)
{
HWND hwnd2;
BOOL ret;
HWND hwnd2;
MSG msg;
+ LONG style;
flush_events( TRUE );
ShowWindow(hwnd, SW_HIDE);
hwnd2 = GetForegroundWindow();
ok(hwnd2 == hwnd, "Wrong foreground window %p\n", hwnd2);
- ok(SetForegroundWindow( GetDesktopWindow() ), "SetForegroundWindow(desktop) error: %d\n", GetLastError());
+ ret = SetForegroundWindow( GetDesktopWindow() );
+ ok(ret, "SetForegroundWindow(desktop) error: %d\n", GetLastError());
hwnd2 = GetForegroundWindow();
ok(hwnd2 != hwnd, "Wrong foreground window %p\n", hwnd2);
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);
static void test_capture_1(void)
{
- HWND button, capture, oldFocus, oldActive;
-
- oldFocus = GetFocus();
- oldActive = GetActiveWindow();
+ HWND button, capture;
capture = GetCapture();
ok(capture == 0, "GetCapture() = %p\n", capture);
check_wnd_state(button, 0, button, button);
DestroyWindow(button);
- check_wnd_state(oldActive, 0, oldFocus, 0);
+ /* old active window test depends on previously executed window
+ * activation tests, and fails under NT4.
+ check_wnd_state(oldActive, 0, oldFocus, 0);*/
}
static void test_capture_2(void)
/* 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 */
HWND hwnd;
WNDCLASSA wclass;
HINSTANCE hInstance = GetModuleHandleA( NULL );
+ ATOM aclass;
if (!pGetGUIThreadInfo)
{
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;
wclass.cbWndExtra = 0;
- assert (RegisterClassA( &wclass ));
- assert (hwnd = CreateWindowA( wclass.lpszClassName, "MenuTest",
- WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0,
- 400, 200, NULL, NULL, hInstance, NULL) );
+ aclass = RegisterClassA( &wclass );
+ ok( aclass, "RegisterClassA failed with error %d\n", GetLastError());
+ hwnd = CreateWindowA( wclass.lpszClassName, "MenuTest",
+ WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0,
+ 400, 200, NULL, NULL, hInstance, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
if (!hwnd) return;
hmenu = CreatePopupMenu();
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",
static void test_SetParent(void)
{
- BOOL ret;
HWND desktop = GetDesktopWindow();
HMENU hMenu;
- HWND parent, child1, child2, child3, child4, sibling;
+ HWND ret, parent, child1, child2, child3, child4, sibling, popup;
+ BOOL bret;
parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
if (!is_win9x) /* Win9x doesn't survive this test */
{
- HWND ret;
-
ok(!SetParent(parent, child1), "SetParent should fail\n");
ok(!SetParent(child2, child3), "SetParent should fail\n");
ok(SetParent(child1, parent) != 0, "SetParent should not fail\n");
ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n");
ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n");
- ret = DestroyWindow(parent);
- ok( ret, "DestroyWindow() error %d\n", GetLastError());
+ 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");
ok(!IsWindow(sibling), "sibling still exists\n");
ok(!IsWindow(child2), "child2 still exists\n");
ok(!IsWindow(child3), "child3 still exists\n");
ok(!IsWindow(child4), "child4 still exists\n");
+
+ parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
+ 100, 100, 200, 200, 0, 0, 0, NULL);
+ assert(parent != 0);
+ child1 = CreateWindowExA(0, "static", NULL, WS_CHILD,
+ 0, 0, 50, 50, parent, 0, 0, NULL);
+ assert(child1 != 0);
+ popup = CreateWindowExA(0, "static", NULL, WS_POPUP,
+ 0, 0, 50, 50, 0, 0, 0, NULL);
+ assert(popup != 0);
+
+ trace("parent %p, child %p, popup %p\n", parent, child1, popup);
+
+ check_parents(parent, desktop, 0, 0, 0, parent, parent);
+ check_parents(child1, parent, parent, parent, 0, parent, parent);
+ check_parents(popup, desktop, 0, 0, 0, popup, popup);
+
+ SetActiveWindow(parent);
+ SetFocus(parent);
+ check_active_state(parent, 0, parent);
+
+ ret = SetParent(popup, child1);
+ ok(ret == desktop, "expected %p, got %p\n", desktop, ret);
+ check_parents(popup, child1, child1, 0, 0, parent, popup);
+ 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);
+ 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");
+
+ ok(!IsWindow(parent), "parent still exists\n");
+ ok(!IsWindow(child1), "child1 still exists\n");
+ ok(!IsWindow(popup), "popup still exists\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)
{
ok(!(lpcs->dwExStyle & WS_EX_WINDOWEDGE), "Window shouldn't have WS_EX_WINDOWEDGE style\n");
ok((lpss->styleOld & ~WS_EX_WINDOWEDGE) == (lpcs->dwExStyle & ~WS_EX_WINDOWEDGE),
- "Ex style (0x%08lx) should match what the caller passed to CreateWindowEx (0x%08lx)\n",
+ "Ex style (0x%08x) should match what the caller passed to CreateWindowEx (0x%08x)\n",
(lpss->styleOld & ~WS_EX_WINDOWEDGE), (lpcs->dwExStyle & ~WS_EX_WINDOWEDGE));
ok(lpss->styleNew == lpcs->style,
}
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);
}
static void check_window_style(DWORD dwStyleIn, DWORD dwExStyleIn, DWORD dwStyleOut, DWORD dwExStyleOut)
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);
- ok((dwActualStyle == dwStyleOut) && (dwActualExStyle == dwExStyleOut),
- "Style (0x%08x) should really be 0x%08x and/or Ex style (0x%08x) should really be 0x%08x\n",
- dwActualStyle, dwStyleOut, dwActualExStyle, dwExStyleOut);
+ 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 */
+ 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;
+ else if ((dwActualStyle & (WS_DLGFRAME | WS_THICKFRAME)) && !(dwExStyleIn & WS_EX_STATICEDGE))
+ dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
+ else
+ 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);
+
+ 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;
+ /* WS_EX_WINDOWEDGE can't always be changed */
+ if (dwExStyleIn & WS_EX_DLGMODALFRAME)
+ dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
+ else if ((dwActualStyle & (WS_DLGFRAME | WS_THICKFRAME)) && !(dwExStyleIn & WS_EX_STATICEDGE))
+ dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
+ else
+ dwExStyleOut = dwExStyleIn & ~WS_EX_WINDOWEDGE;
+ ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
+ /* FIXME: Remove the condition below once Wine is fixed */
+ if (dwActualExStyle != dwExStyleOut)
+ todo_wine ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
+ else
+ ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
DestroyWindow(hwnd);
if (hwndParent) DestroyWindow(hwndParent);
register_style_check_class();
check_window_style(0, 0, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE);
+ check_window_style(WS_DLGFRAME, 0, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE);
+ check_window_style(WS_THICKFRAME, 0, WS_THICKFRAME|WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE);
+ check_window_style(WS_DLGFRAME, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_STATICEDGE);
+ check_window_style(WS_THICKFRAME, WS_EX_STATICEDGE, WS_THICKFRAME|WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_STATICEDGE);
check_window_style(WS_OVERLAPPEDWINDOW, 0, WS_CLIPSIBLINGS|WS_OVERLAPPEDWINDOW, WS_EX_WINDOWEDGE);
check_window_style(WS_CHILD, 0, WS_CHILD, 0);
+ check_window_style(WS_CHILD|WS_DLGFRAME, 0, WS_CHILD|WS_DLGFRAME, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD|WS_THICKFRAME, 0, WS_CHILD|WS_THICKFRAME, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD|WS_DLGFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_DLGFRAME, WS_EX_STATICEDGE);
+ check_window_style(WS_CHILD|WS_THICKFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_THICKFRAME, WS_EX_STATICEDGE);
+ check_window_style(WS_CHILD|WS_CAPTION, 0, WS_CHILD|WS_CAPTION, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD|WS_CAPTION|WS_SYSMENU, 0, WS_CHILD|WS_CAPTION|WS_SYSMENU, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD, WS_EX_WINDOWEDGE, WS_CHILD, 0);
+ check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME, WS_CHILD, WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
+ check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
+ check_window_style(WS_CHILD|WS_POPUP, 0, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, 0);
+ check_window_style(WS_CHILD|WS_POPUP|WS_DLGFRAME, 0, WS_CHILD|WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD|WS_POPUP|WS_THICKFRAME, 0, WS_CHILD|WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_window_style(WS_CHILD|WS_POPUP|WS_DLGFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
+ check_window_style(WS_CHILD|WS_POPUP|WS_THICKFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
+ check_window_style(WS_CHILD|WS_POPUP, WS_EX_APPWINDOW, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, WS_EX_APPWINDOW);
+ check_window_style(WS_CHILD|WS_POPUP, WS_EX_WINDOWEDGE, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, 0);
check_window_style(WS_CHILD, WS_EX_WINDOWEDGE, WS_CHILD, 0);
check_window_style(0, WS_EX_TOOLWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW);
check_window_style(WS_POPUP, 0, WS_POPUP|WS_CLIPSIBLINGS, 0);
check_window_style(WS_POPUP, WS_EX_WINDOWEDGE, WS_POPUP|WS_CLIPSIBLINGS, 0);
- check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME, WS_CHILD, WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
- check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
+ check_window_style(WS_POPUP|WS_DLGFRAME, 0, WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_window_style(WS_POPUP|WS_THICKFRAME, 0, WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_window_style(WS_POPUP|WS_DLGFRAME, WS_EX_STATICEDGE, WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
+ check_window_style(WS_POPUP|WS_THICKFRAME, WS_EX_STATICEDGE, WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
check_window_style(WS_CAPTION, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE);
check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE);
}
}
+static INT_PTR WINAPI empty_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ return 0;
+}
+
+static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_out, DWORD ex_style_out)
+{
+ struct
+ {
+ DLGTEMPLATE dt;
+ WORD menu_name;
+ WORD class_id;
+ WORD class_atom;
+ WCHAR caption[1];
+ } dlg_data;
+ DWORD style, ex_style;
+ HWND hwnd, parent = 0;
+
+ if (style_in & WS_CHILD)
+ parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
+ 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+
+ dlg_data.dt.style = style_in;
+ dlg_data.dt.dwExtendedStyle = ex_style_in;
+ dlg_data.dt.cdit = 0;
+ dlg_data.dt.x = 0;
+ dlg_data.dt.y = 0;
+ dlg_data.dt.cx = 100;
+ dlg_data.dt.cy = 100;
+ dlg_data.menu_name = 0;
+ dlg_data.class_id = 0;
+ dlg_data.class_atom = 0;
+ dlg_data.caption[0] = 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 = 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 */
+ 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;
+ else if ((style & (WS_DLGFRAME | WS_THICKFRAME)) && !(ex_style_in & WS_EX_STATICEDGE))
+ ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
+ else
+ 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);
+
+ 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;
+ ok(style == style_out, "expected style %#x, got %#x\n", style_out, 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;
+ else if ((style & (WS_DLGFRAME | WS_THICKFRAME)) && !(ex_style_in & WS_EX_STATICEDGE))
+ ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
+ else
+ ex_style_out = ex_style_in & ~WS_EX_WINDOWEDGE;
+ /* FIXME: Remove the condition below once Wine is fixed */
+ if (ex_style != ex_style_out)
+ todo_wine ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
+ else
+ ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
+
+ DestroyWindow(hwnd);
+ DestroyWindow(parent);
+}
+
+static void test_dialog_styles(void)
+{
+ check_dialog_style(0, 0, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_DLGFRAME, 0, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_THICKFRAME, 0, WS_THICKFRAME|WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_DLGFRAME, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_STATICEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_THICKFRAME, WS_EX_STATICEDGE, WS_THICKFRAME|WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_STATICEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(DS_CONTROL, 0, WS_CLIPSIBLINGS|WS_CAPTION|DS_CONTROL, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CAPTION, 0, WS_CAPTION|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_BORDER, 0, WS_CAPTION|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_DLGFRAME, 0, WS_CAPTION|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_BORDER|DS_CONTROL, 0, WS_CAPTION|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_DLGFRAME|DS_CONTROL, 0, WS_CAPTION|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CAPTION|WS_SYSMENU, 0, WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_SYSMENU, 0, WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CAPTION|DS_CONTROL, 0, WS_CAPTION|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_SYSMENU|DS_CONTROL, 0, WS_CAPTION|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CAPTION|WS_SYSMENU|DS_CONTROL, 0, WS_CAPTION|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_OVERLAPPEDWINDOW, 0, WS_CLIPSIBLINGS|WS_OVERLAPPEDWINDOW, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD, 0, WS_CHILD, 0);
+ check_dialog_style(WS_CHILD|WS_DLGFRAME, 0, WS_CHILD|WS_DLGFRAME, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_THICKFRAME, 0, WS_CHILD|WS_THICKFRAME, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_DLGFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_DLGFRAME, WS_EX_STATICEDGE);
+ check_dialog_style(WS_CHILD|WS_THICKFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_THICKFRAME, WS_EX_STATICEDGE);
+ check_dialog_style(WS_CHILD|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_CAPTION, 0, WS_CHILD|WS_CAPTION, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_BORDER, 0, WS_CHILD|WS_BORDER, 0);
+ check_dialog_style(WS_CHILD|WS_DLGFRAME, 0, WS_CHILD|WS_DLGFRAME, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_BORDER|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_DLGFRAME|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_CAPTION|WS_SYSMENU, 0, WS_CHILD|WS_CAPTION|WS_SYSMENU, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_SYSMENU, 0, WS_CHILD|WS_SYSMENU, 0);
+ check_dialog_style(WS_CHILD|WS_CAPTION|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_SYSMENU|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_CAPTION|WS_SYSMENU|DS_CONTROL, 0, WS_CHILD|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD, WS_EX_WINDOWEDGE, WS_CHILD, 0);
+ check_dialog_style(WS_CHILD, WS_EX_DLGMODALFRAME, WS_CHILD, WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
+ check_dialog_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
+ check_dialog_style(WS_CHILD|WS_POPUP, 0, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, 0);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_DLGFRAME, 0, WS_CHILD|WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_THICKFRAME, 0, WS_CHILD|WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_DLGFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_THICKFRAME, WS_EX_STATICEDGE, WS_CHILD|WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|DS_CONTROL, 0, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_CAPTION, 0, WS_CHILD|WS_POPUP|WS_CAPTION|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_BORDER, 0, WS_CHILD|WS_POPUP|WS_BORDER|WS_CLIPSIBLINGS, 0);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_DLGFRAME, 0, WS_CHILD|WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_BORDER|DS_CONTROL, 0, WS_CHILD|WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_DLGFRAME|DS_CONTROL, 0, WS_CHILD|WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_CAPTION|WS_SYSMENU, 0, WS_CHILD|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_SYSMENU, 0, WS_CHILD|WS_POPUP|WS_SYSMENU|WS_CLIPSIBLINGS, 0);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_CAPTION|DS_CONTROL, 0, WS_CHILD|WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_SYSMENU|DS_CONTROL, 0, WS_CHILD|WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP|WS_CAPTION|WS_SYSMENU|DS_CONTROL, 0, WS_CHILD|WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CHILD|WS_POPUP, WS_EX_APPWINDOW, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, WS_EX_APPWINDOW);
+ check_dialog_style(WS_CHILD|WS_POPUP, WS_EX_WINDOWEDGE, WS_CHILD|WS_POPUP|WS_CLIPSIBLINGS, 0);
+ check_dialog_style(WS_CHILD, WS_EX_WINDOWEDGE, WS_CHILD, 0);
+ check_dialog_style(0, WS_EX_TOOLWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP, 0, WS_POPUP|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP, WS_EX_WINDOWEDGE, WS_POPUP|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_DLGFRAME, 0, WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_THICKFRAME, 0, WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_DLGFRAME, WS_EX_STATICEDGE, WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_THICKFRAME, WS_EX_STATICEDGE, WS_POPUP|WS_THICKFRAME|WS_CLIPSIBLINGS, WS_EX_STATICEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|DS_CONTROL, 0, WS_POPUP|WS_CLIPSIBLINGS|DS_CONTROL, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_CAPTION, 0, WS_POPUP|WS_CAPTION|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_BORDER, 0, WS_POPUP|WS_BORDER|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_DLGFRAME, 0, WS_POPUP|WS_DLGFRAME|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_BORDER|DS_CONTROL, 0, WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_DLGFRAME|DS_CONTROL, 0, WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_CAPTION|WS_SYSMENU, 0, WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_SYSMENU, 0, WS_POPUP|WS_SYSMENU|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_CAPTION|DS_CONTROL, 0, WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_SYSMENU|DS_CONTROL, 0, WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_POPUP|WS_CAPTION|WS_SYSMENU|DS_CONTROL, 0, WS_POPUP|DS_CONTROL|WS_CLIPSIBLINGS, WS_EX_CONTROLPARENT);
+ check_dialog_style(WS_CAPTION, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+
+ if (pGetLayeredWindowAttributes)
+ {
+ check_dialog_style(0, WS_EX_LAYERED, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ check_dialog_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW, WS_CLIPSIBLINGS|WS_CAPTION,
+ WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE|WS_EX_CONTROLPARENT);
+ }
+}
+
static void test_scrollwindow( HWND hwnd)
{
HDC hdc;
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);
HWND hwnd;
INT rc;
+ ok(!IsWindow(0), "IsWindow(0)\n");
+ ok(!IsWindow(HWND_BROADCAST), "IsWindow(HWND_BROADCAST)\n");
+ ok(!IsWindow(HWND_TOPMOST), "IsWindow(HWND_TOPMOST)\n");
+
/* Just a param check */
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 y size %d/%d\n", cs->cy, expected_cy );
ok( (rect.right - rect.left == expected_rect.right - expected_rect.left &&
rect.bottom - rect.top == expected_rect.bottom - expected_rect.top) ||
+ (rect.right - rect.left == min( 65535, expected_rect.right - expected_rect.left ) &&
+ rect.bottom - rect.top == min( 65535, expected_rect.bottom - expected_rect.top )) ||
broken( rect.right - rect.left == broken_rect.right - broken_rect.left &&
rect.bottom - rect.top == broken_rect.bottom - broken_rect.top) ||
broken( rect.right - rect.left == (short)broken_rect.right - (short)broken_rect.left &&
"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;
MINMAXINFO minmax;
+ BOOL res;
#define expect_menu(window, menu) \
SetLastError(0xdeadbeef); \
- ok(GetMenu(window) == (HMENU)menu, "GetMenu error %d\n", GetLastError())
+ res = (GetMenu(window) == (HMENU)menu); \
+ 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 ||\
assert(parent != 0);
SetLastError(0xdeadbeef);
- ok(IsMenu(hmenu), "IsMenu error %d\n", GetLastError());
+ res = IsMenu(hmenu);
+ ok(res, "IsMenu error %d\n", GetLastError());
/* 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 );
hwnd = CreateWindowExA(0, "Sizes_WndClass", NULL, WS_CHILD, 300000, 300000, 200000, 200000, parent, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
GetClientRect( hwnd, &rc );
- ok( rc.right == 200000 || broken(rc.right == (short)200000), "invalid rect right %u\n", rc.right );
- ok( rc.bottom == 200000 || broken(rc.bottom == (short)200000), "invalid rect bottom %u\n", rc.bottom );
+ ok( rc.right == 200000 || rc.right == 65535 || broken(rc.right == (short)200000),
+ "invalid rect right %u\n", rc.right );
+ ok( rc.bottom == 200000 || rc.bottom == 65535 || broken(rc.bottom == (short)200000),
+ "invalid rect bottom %u\n", rc.bottom );
DestroyWindow(hwnd);
expected_cx = expected_cy = -10;
/* 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;
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
GetClientRect( hwnd, &rc );
ok( rc.right == 100, "invalid rect right %u\n", rc.right );
- ok( rc.bottom == 0x7fffffff - 10 || broken(rc.bottom == 0), "invalid rect bottom %u\n", rc.bottom );
+ ok( rc.bottom == 0x7fffffff - 10 || rc.bottom ==65535 || broken(rc.bottom == 0),
+ "invalid rect bottom %u\n", rc.bottom );
DestroyWindow(hwnd);
expected_cx = 0x7fffffff;
hwnd = CreateWindowExA(0, "Sizes_WndClass", NULL, WS_CHILD, 20, 10, 0x7fffffff, 0x7fffffff, parent, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
GetClientRect( hwnd, &rc );
- ok( rc.right == 0x7fffffff - 20 || broken(rc.right == 0), "invalid rect right %u\n", rc.right );
- ok( rc.bottom == 0x7fffffff - 10 || broken(rc.bottom == 0), "invalid rect bottom %u\n", rc.bottom );
+ ok( rc.right == 0x7fffffff - 20 || rc.right == 65535 || broken(rc.right == 0),
+ "invalid rect right %u\n", rc.right );
+ ok( rc.bottom == 0x7fffffff - 10 || rc.right == 65535 || broken(rc.bottom == 0),
+ "invalid rect bottom %u\n", rc.bottom );
DestroyWindow(hwnd);
/* top level window */
ok( rc.bottom <= expected_cy, "invalid rect bottom %u\n", rc.bottom );
DestroyWindow(hwnd);
+ if (pGetLayout && pSetLayout)
+ {
+ HDC hdc = GetDC( parent );
+ pSetLayout( hdc, LAYOUT_RTL );
+ if (pGetLayout( hdc ))
+ {
+ ReleaseDC( parent, hdc );
+ DestroyWindow( parent );
+ SetLastError( 0xdeadbeef );
+ 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 );
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 20, 20, parent, 0, 0, NULL);
+ ok( hwnd != 0, "creation failed err %u\n", GetLastError());
+ expect_ex_style( hwnd, WS_EX_LAYOUTRTL );
+ DestroyWindow( hwnd );
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 20, 20, parent, 0, 0, NULL);
+ ok( hwnd != 0, "creation failed err %u\n", GetLastError());
+ expect_ex_style( hwnd, 0 );
+ DestroyWindow( hwnd );
+ SetWindowLongW( parent, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT );
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 20, 20, parent, 0, 0, NULL);
+ ok( hwnd != 0, "creation failed err %u\n", GetLastError());
+ expect_ex_style( hwnd, 0 );
+ DestroyWindow( hwnd );
+
+ if (pGetProcessDefaultLayout && pSetProcessDefaultLayout)
+ {
+ DWORD layout;
+
+ SetLastError( 0xdeadbeef );
+ ok( !pGetProcessDefaultLayout( NULL ), "GetProcessDefaultLayout succeeded\n" );
+ ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
+ SetLastError( 0xdeadbeef );
+ res = pGetProcessDefaultLayout( &layout );
+ ok( res, "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+ ok( layout == 0, "GetProcessDefaultLayout wrong layout %x\n", layout );
+ SetLastError( 0xdeadbeef );
+ res = pSetProcessDefaultLayout( 7 );
+ ok( res, "SetProcessDefaultLayout failed err %u\n", GetLastError ());
+ res = pGetProcessDefaultLayout( &layout );
+ ok( res, "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+ ok( layout == 7, "GetProcessDefaultLayout wrong layout %x\n", layout );
+ SetLastError( 0xdeadbeef );
+ res = pSetProcessDefaultLayout( LAYOUT_RTL );
+ ok( res, "SetProcessDefaultLayout failed err %u\n", GetLastError ());
+ res = pGetProcessDefaultLayout( &layout );
+ ok( res, "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+ ok( layout == LAYOUT_RTL, "GetProcessDefaultLayout wrong layout %x\n", layout );
+ 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 = 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( hwnd );
+ pSetProcessDefaultLayout( 0 );
+ }
+ else win_skip( "SetProcessDefaultLayout not supported\n" );
+ }
+ else win_skip( "SetLayout not supported\n" );
+ }
+ else win_skip( "SetLayout not available\n" );
+
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 instad of %d\n", GetLastError());
+ "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 instad of %d\n", GetLastError());
+ "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);
}
}
{
HWND hwnd;
DWORD style;
- RECT rcMain, rc;
+ RECT rcMain, rc, rcMinimized;
LPARAM ret;
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");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
+ GetWindowRect(hwnd, &rcMinimized);
+ ok(!EqualRect(&rcMain, &rcMinimized), "rects shouldn't match\n");
+ /* shouldn't be able to resize minimized windows */
+ ret = SetWindowPos(hwnd, 0, 0, 0,
+ (rcMinimized.right - rcMinimized.left) * 2,
+ (rcMinimized.bottom - rcMinimized.top) * 2,
+ SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+ ok(ret, "not expected ret: %lu\n", ret);
GetWindowRect(hwnd, &rc);
- ok(!EqualRect(&rcMain, &rc), "rects shouldn't match\n");
+ ok(EqualRect(&rc, &rcMinimized), "rects should match\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 );
COLORREF key = 0;
BYTE alpha = 0;
DWORD flags = 0;
+ POINT pt = { 0, 0 };
+ SIZE sz = { 200, 200 };
+ HDC hdc;
+ HBITMAP hbm;
BOOL ret;
- if (!pGetLayeredWindowAttributes || !pSetLayeredWindowAttributes)
+ if (!pGetLayeredWindowAttributes || !pSetLayeredWindowAttributes || !pUpdateLayeredWindow)
{
win_skip( "layered windows not supported\n" );
return;
}
+
+ hdc = CreateCompatibleDC( 0 );
+ hbm = CreateCompatibleBitmap( hdc, 200, 200 );
+ SelectObject( hdc, hbm );
+
hwnd = CreateWindowExA(0, "MainWindowClass", "message window", WS_CAPTION,
100, 100, 200, 200, 0, 0, 0, NULL);
assert( hwnd );
+ SetLastError( 0xdeadbeef );
+ ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
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( ret, "UpdateLayeredWindow should succeed on layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pSetLayeredWindowAttributes( hwnd, 0x123456, 44, LWA_ALPHA );
ok( key == 0x123456 || key == 0, "wrong color key %x\n", key );
ok( alpha == 44, "wrong alpha %u\n", alpha );
ok( flags == LWA_ALPHA, "wrong flags %x\n", flags );
+ SetLastError( 0xdeadbeef );
+ ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on layered but initialized window\n" );
+ 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( ret, "UpdateLayeredWindow should succeed on layered window\n" );
+ ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE | ULW_EX_NORESIZE );
+ ok( !ret, "UpdateLayeredWindow should fail with ex flag\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ if (pUpdateLayeredWindowIndirect)
+ {
+ UPDATELAYEREDWINDOWINFO info;
+ info.cbSize = sizeof(info);
+ info.hdcDst = 0;
+ info.pptDst = NULL;
+ info.psize = &sz;
+ info.hdcSrc = hdc;
+ info.pptSrc = &pt;
+ info.crKey = 0;
+ info.pblend = NULL;
+ info.dwFlags = ULW_OPAQUE | ULW_EX_NORESIZE;
+ info.prcDirty = NULL;
+ ret = pUpdateLayeredWindowIndirect( hwnd, &info );
+ ok( ret, "UpdateLayeredWindowIndirect should succeed on layered window\n" );
+ sz.cx--;
+ ret = pUpdateLayeredWindowIndirect( hwnd, &info );
+ ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
+ ok( GetLastError() == ERROR_INCORRECT_SIZE || broken(GetLastError() == ERROR_MR_MID_NOT_FOUND),
+ "wrong error %u\n", GetLastError() );
+ info.dwFlags = ULW_OPAQUE;
+ ret = pUpdateLayeredWindowIndirect( hwnd, &info );
+ ok( ret, "UpdateLayeredWindowIndirect should succeed on layered window\n" );
+ sz.cx++;
+ info.dwFlags = ULW_OPAQUE | 0xf00;
+ ret = pUpdateLayeredWindowIndirect( hwnd, &info );
+ ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ info.cbSize--;
+ info.dwFlags = ULW_OPAQUE;
+ ret = pUpdateLayeredWindowIndirect( hwnd, &info );
+ ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ ret = pUpdateLayeredWindowIndirect( hwnd, NULL );
+ ok( !ret, "UpdateLayeredWindowIndirect should fail\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ }
+
ret = pSetLayeredWindowAttributes( hwnd, 0x654321, 22, LWA_COLORKEY | LWA_ALPHA );
ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( key == 0x654321, "wrong color key %x\n", key );
ok( alpha == 22, "wrong alpha %u\n", alpha );
ok( flags == (LWA_COLORKEY | LWA_ALPHA), "wrong flags %x\n", flags );
+ SetLastError( 0xdeadbeef );
+ ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on layered but initialized window\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
ret = pSetLayeredWindowAttributes( hwnd, 0x888888, 33, LWA_COLORKEY );
ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
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 );
ok( flags == 0, "wrong flags %x\n", flags );
DestroyWindow( hwnd );
+ DeleteDC( hdc );
+ DeleteObject( hbm );
}
static MONITORINFO mi;
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;
SetLastError(0xdeadbeef);
- ok(RegisterClassA(&cls),"RegisterClassA failed, error: %u\n", GetLastError());
+ success = RegisterClassA(&cls);
+ ok(success,"RegisterClassA failed, error: %u\n", GetLastError());
for(i = 0; i < NUMBER_OF_THICK_CHILD_TESTS; i++)
{
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 )
{
HWND hwnd;
RECT r;
- int ret;
+ int ret, width;
HRGN hrgn;
if (!pGetWindowRgnBox)
ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
"Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, r.top,
r.right, r.bottom);
- DeleteObject(hrgn);
+ if (pMirrorRgn)
+ {
+ hrgn = CreateRectRgn(2, 3, 10, 15);
+ ret = pMirrorRgn( hwnd, hrgn );
+ ok( ret == TRUE, "MirrorRgn failed %u\n", ret );
+ r.left = r.top = r.right = r.bottom = 0;
+ GetWindowRect( hwnd, &r );
+ width = r.right - r.left;
+ r.left = r.top = r.right = r.bottom = 0;
+ ret = GetRgnBox( hrgn, &r );
+ ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret );
+ ok( r.left == width - 10 && r.top == 3 && r.right == width - 2 && r.bottom == 15,
+ "Wrong rectangle (%d,%d,%d,%d) for width %d\n", r.left, r.top, r.right, r.bottom, width );
+ }
+ else win_skip( "MirrorRgn not supported\n" );
}
DestroyWindow(hwnd);
}
+static void test_rtl_layout(void)
+{
+ HWND parent, child;
+ RECT r;
+ POINT pt;
+
+ if (!pSetProcessDefaultLayout)
+ {
+ win_skip( "SetProcessDefaultLayout not supported\n" );
+ return;
+ }
+
+ parent = CreateWindowExA(WS_EX_LAYOUTRTL, "static", NULL, WS_POPUP, 100, 100, 300, 300, NULL, 0, 0, NULL);
+ child = CreateWindowExA(0, "static", NULL, WS_CHILD, 10, 10, 20, 20, parent, 0, 0, NULL);
+
+ GetWindowRect( parent, &r );
+ ok( r.left == 100 && r.right == 400, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ GetClientRect( parent, &r );
+ ok( r.left == 0 && r.right == 300, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ GetClientRect( child, &r );
+ ok( r.left == 0 && r.right == 20, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ MapWindowPoints( child, parent, (POINT *)&r, 2 );
+ ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ GetWindowRect( child, &r );
+ ok( r.left == 370 && r.right == 390, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
+ ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ GetWindowRect( child, &r );
+ MapWindowPoints( NULL, parent, (POINT *)&r, 1 );
+ MapWindowPoints( NULL, parent, (POINT *)&r + 1, 1 );
+ ok( r.left == 30 && r.right == 10, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ pt.x = pt.y = 12;
+ MapWindowPoints( child, parent, &pt, 1 );
+ ok( pt.x == 22 && pt.y == 22, "wrong point %d,%d\n", pt.x, pt.y );
+ SetWindowPos( parent, 0, 0, 0, 250, 250, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
+ GetWindowRect( parent, &r );
+ ok( r.left == 100 && r.right == 350, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ GetWindowRect( child, &r );
+ ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ SetWindowLongW( parent, GWL_EXSTYLE, 0 );
+ GetWindowRect( child, &r );
+ ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
+ ok( r.left == 220 && r.right == 240, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ SetWindowLongW( parent, GWL_EXSTYLE, WS_EX_LAYOUTRTL );
+ GetWindowRect( child, &r );
+ ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
+ ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ SetWindowPos( child, 0, 0, 0, 30, 30, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
+ GetWindowRect( child, &r );
+ ok( r.left == 310 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
+ ok( r.left == 10 && r.right == 40, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom );
+ DestroyWindow( child );
+ DestroyWindow( parent );
+}
+
+static void test_FlashWindowEx(void)
+{
+ HWND hwnd;
+ FLASHWINFO finfo;
+ BOOL prev, ret;
+
+ if (!pFlashWindowEx)
+ {
+ win_skip( "FlashWindowEx not supported\n" );
+ return;
+ }
+
+ hwnd = CreateWindowExA( 0, "MainWindowClass", "FlashWindow", WS_POPUP,
+ 0, 0, 0, 0, 0, 0, 0, NULL );
+ ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
+
+ finfo.cbSize = sizeof(FLASHWINFO);
+ finfo.dwFlags = FLASHW_TIMER;
+ finfo.uCount = 3;
+ finfo.dwTimeout = 200;
+ finfo.hwnd = NULL;
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+ todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
+ "FlashWindowEx returned with %d\n", GetLastError());
+
+ finfo.hwnd = hwnd;
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(NULL);
+ todo_wine ok(!ret && GetLastError() == ERROR_NOACCESS,
+ "FlashWindowEx returned with %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+ todo_wine ok(!ret, "previous window state should not be active\n");
+
+ finfo.cbSize = sizeof(FLASHWINFO) - 1;
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+ todo_wine ok(!ret && GetLastError()==ERROR_INVALID_PARAMETER,
+ "FlashWindowEx succeeded\n");
+
+ finfo.cbSize = sizeof(FLASHWINFO) + 1;
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+ todo_wine ok(!ret && GetLastError()==ERROR_INVALID_PARAMETER,
+ "FlashWindowEx succeeded\n");
+ finfo.cbSize = sizeof(FLASHWINFO);
+
+ DestroyWindow( hwnd );
+
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+ todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
+ "FlashWindowEx returned with %d\n", GetLastError());
+
+ ok(finfo.cbSize == sizeof(FLASHWINFO), "FlashWindowEx modified cdSize to %x\n", finfo.cbSize);
+ ok(finfo.hwnd == hwnd, "FlashWindowEx modified hwnd to %p\n", finfo.hwnd);
+ ok(finfo.dwFlags == FLASHW_TIMER, "FlashWindowEx modified dwFlags to %x\n", finfo.dwFlags);
+ ok(finfo.uCount == 3, "FlashWindowEx modified uCount to %x\n", finfo.uCount);
+ ok(finfo.dwTimeout == 200, "FlashWindowEx modified dwTimeout to %x\n", finfo.dwTimeout);
+
+ hwnd = CreateWindowExA( 0, "MainWindowClass", "FlashWindow", WS_VISIBLE | WS_POPUPWINDOW,
+ 0, 0, 0, 0, 0, 0, 0, NULL );
+ ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
+ finfo.hwnd = hwnd;
+
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(NULL);
+ todo_wine ok(!ret && GetLastError() == ERROR_NOACCESS,
+ "FlashWindowEx returned with %d\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ prev = pFlashWindowEx(&finfo);
+
+ ok(finfo.cbSize == sizeof(FLASHWINFO), "FlashWindowEx modified cdSize to %x\n", finfo.cbSize);
+ ok(finfo.hwnd == hwnd, "FlashWindowEx modified hwnd to %p\n", finfo.hwnd);
+ ok(finfo.dwFlags == FLASHW_TIMER, "FlashWindowEx modified dwFlags to %x\n", finfo.dwFlags);
+ ok(finfo.uCount == 3, "FlashWindowEx modified uCount to %x\n", finfo.uCount);
+ ok(finfo.dwTimeout == 200, "FlashWindowEx modified dwTimeout to %x\n", finfo.dwTimeout);
+
+ finfo.dwFlags = FLASHW_STOP;
+ SetLastError(0xdeadbeef);
+ ret = pFlashWindowEx(&finfo);
+todo_wine
+ ok(prev != ret, "previous window state should be different\n");
+
+ DestroyWindow( hwnd );
+}
+
+static void test_FindWindowEx(void)
+{
+ HWND hwnd, found;
+ CHAR title[1];
+
+ hwnd = CreateWindowExA( 0, "MainWindowClass", "caption", WS_POPUP, 0,0,0,0, 0, 0, 0, NULL );
+ ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
+
+ title[0] = 0;
+
+ found = FindWindowExA( 0, 0, "MainWindowClass", title );
+ ok( found == NULL, "expected a NULL hwnd\n" );
+ found = FindWindowExA( 0, 0, "MainWindowClass", NULL );
+ ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
+
+ DestroyWindow( hwnd );
+
+ hwnd = CreateWindowExA( 0, "MainWindowClass", NULL, WS_POPUP, 0,0,0,0, 0, 0, 0, NULL );
+ ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() );
+
+ found = FindWindowExA( 0, 0, "MainWindowClass", title );
+ ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
+ found = FindWindowExA( 0, 0, "MainWindowClass", NULL );
+ ok( found == hwnd, "found is %p, expected a valid hwnd\n", found );
+
+ DestroyWindow( hwnd );
+
+ /* test behaviour with a window title that is an empty character */
+ found = FindWindowExA( 0, 0, "Shell_TrayWnd", title );
+ ok( found != NULL, "found is NULL, expected a valid hwnd\n" );
+ found = FindWindowExA( 0, 0, "Shell_TrayWnd", NULL );
+ ok( found != NULL, "found is NULL, expected a valid hwnd\n" );
+}
+
+static void test_GetLastActivePopup(void)
+{
+ HWND hwndOwner, hwndPopup1, hwndPopup2;
+
+ hwndOwner = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_POPUPWINDOW,
+ 100, 100, 200, 200,
+ NULL, 0, GetModuleHandleA(NULL), NULL);
+ hwndPopup1 = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_POPUPWINDOW,
+ 100, 100, 200, 200,
+ hwndOwner, 0, GetModuleHandleA(NULL), NULL);
+ hwndPopup2 = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_VISIBLE | WS_POPUPWINDOW,
+ 100, 100, 200, 200,
+ hwndPopup1, 0, GetModuleHandleA(NULL), NULL);
+ ok( GetLastActivePopup(hwndOwner) == hwndPopup2, "wrong last active popup\n" );
+ DestroyWindow( hwndPopup2 );
+ DestroyWindow( hwndPopup1 );
+ DestroyWindow( hwndOwner );
+}
+
+static LRESULT WINAPI my_httrasparent_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+ if (msg == WM_NCHITTEST) return HTTRANSPARENT;
+ return DefWindowProcA(hwnd, msg, wp, lp);
+}
+
+static LRESULT WINAPI my_window_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+ return DefWindowProcA(hwnd, msg, wp, lp);
+}
+
+static void create_window_tree(HWND parent, HWND *window, int size)
+{
+ static const DWORD style[] = { 0, WS_VISIBLE, WS_DISABLED, WS_VISIBLE | WS_DISABLED };
+ int i, pos;
+
+ memset(window, 0, size * sizeof(window[0]));
+
+ pos = 0;
+ for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
+ {
+ assert(pos < size);
+ 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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] = 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];
+ 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 = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
+ attrs->class_name[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 = !lstrcmpiA(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
+ attrs->is_httransparent = hittest == HTTRANSPARENT;
+ attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0;
+}
+
+static int window_to_index(HWND hwnd, HWND *window, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ {
+ if (!window[i]) break;
+ if (window[i] == hwnd) return i;
+ }
+ return -1;
+}
+
+static void test_child_window_from_point(void)
+{
+ static const int real_child_pos[] = { 14,15,16,17,18,19,20,21,24,25,26,27,42,43,
+ 44,45,46,47,48,49,52,53,54,55,51,50,23,22,-1 };
+ static const int real_child_pos_nt4[] = { 14,15,16,17,20,21,24,25,26,27,42,43,44,45,
+ 48,49,52,53,54,55,51,50,47,46,23,22,19,18,-1 };
+ WNDCLASSA cls;
+ HWND hwnd, parent, window[100];
+ POINT pt;
+ int found_invisible, found_disabled, found_groupbox, found_httransparent, found_extransparent;
+ int ret, i;
+
+ ret = GetClassInfoA(0, "Button", &cls);
+ ok(ret, "GetClassInfo(Button) failed\n");
+ cls.lpszClassName = "my_button";
+ ret = RegisterClassA(&cls);
+ ok(ret, "RegisterClass(my_button) failed\n");
+
+ cls.lpszClassName = "my_httrasparent";
+ cls.lpfnWndProc = my_httrasparent_proc;
+ ret = RegisterClassA(&cls);
+ ok(ret, "RegisterClass(my_httrasparent) failed\n");
+
+ cls.lpszClassName = "my_window";
+ cls.lpfnWndProc = my_window_proc;
+ ret = RegisterClassA(&cls);
+ ok(ret, "RegisterClass(my_window) failed\n");
+
+ parent = CreateWindowExA(0, "MainWindowClass", NULL,
+ WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE,
+ 100, 100, 200, 200,
+ 0, 0, GetModuleHandleA(NULL), NULL);
+ ok(parent != 0, "CreateWindowEx failed\n");
+ trace("parent %p\n", parent);
+
+ create_window_tree(parent, window, sizeof(window)/sizeof(window[0]));
+
+ found_invisible = 0;
+ found_disabled = 0;
+ found_groupbox = 0;
+ found_httransparent = 0;
+ found_extransparent = 0;
+
+ /* FIXME: also test WindowFromPoint, ChildWindowFromPoint, ChildWindowFromPointEx */
+ for (i = 0; i < sizeof(real_child_pos)/sizeof(real_child_pos[0]); i++)
+ {
+ struct window_attributes attrs;
+
+ pt.x = pt.y = 50;
+ hwnd = RealChildWindowFromPoint(parent, pt);
+ ok(hwnd != 0, "RealChildWindowFromPoint failed\n");
+ ret = window_to_index(hwnd, window, sizeof(window)/sizeof(window[0]));
+ /* FIXME: remove once Wine is fixed */
+ if (ret != real_child_pos[i])
+ todo_wine ok(ret == real_child_pos[i] || broken(ret == real_child_pos_nt4[i]), "expected %d, got %d\n", real_child_pos[i], ret);
+ else
+ ok(ret == real_child_pos[i] || broken(ret == real_child_pos_nt4[i]), "expected %d, got %d\n", real_child_pos[i], ret);
+
+ get_window_attributes(hwnd, &attrs);
+ if (!attrs.is_visible) found_invisible++;
+ if (!attrs.is_enabled) found_disabled++;
+ if (attrs.is_groupbox) found_groupbox++;
+ if (attrs.is_httransparent) found_httransparent++;
+ if (attrs.is_extransparent) found_extransparent++;
+
+ if (ret != real_child_pos[i] && ret != -1)
+ {
+ trace("found hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox %d, is_httransparent %d, is_extransparent %d\n",
+ hwnd, attrs.class_name, attrs.is_visible, attrs.is_enabled, attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent);
+ get_window_attributes(window[real_child_pos[i]], &attrs);
+ trace("expected hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox %d, is_httransparent %d, is_extransparent %d\n",
+ window[real_child_pos[i]], attrs.class_name, attrs.is_visible, attrs.is_enabled, attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent);
+ }
+ if (ret == -1)
+ {
+ ok(hwnd == parent, "expected %p, got %p\n", parent, hwnd);
+ break;
+ }
+ DestroyWindow(hwnd);
+ }
+
+ DestroyWindow(parent);
+
+ ok(!found_invisible, "found %d invisible windows\n", found_invisible);
+ ok(found_disabled, "found %d disabled windows\n", found_disabled);
+todo_wine
+ ok(found_groupbox == 4, "found %d groupbox windows\n", found_groupbox);
+ ok(found_httransparent, "found %d httransparent windows\n", found_httransparent);
+todo_wine
+ ok(found_extransparent, "found %d extransparent windows\n", found_extransparent);
+
+ ret = UnregisterClassA("my_button", cls.hInstance);
+ ok(ret, "UnregisterClass(my_button) failed\n");
+ ret = UnregisterClassA("my_httrasparent", cls.hInstance);
+ ok(ret, "UnregisterClass(my_httrasparent) failed\n");
+ ret = UnregisterClassA("my_window", cls.hInstance);
+ ok(ret, "UnregisterClass(my_window) failed\n");
+}
+
+static void test_map_points(void)
+{
+ BOOL ret;
+ POINT p;
+ HWND wnd, wnd0, dwnd;
+ INT n;
+ DWORD err;
+ POINT pos = { 100, 200 };
+ int width = 150;
+ int height = 150;
+ RECT window_rect;
+ RECT client_rect;
+
+ /* Create test windows */
+ wnd = CreateWindowA("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
+ ok(wnd != NULL, "Failed %p\n", wnd);
+ wnd0 = CreateWindowA("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
+ ok(wnd0 != NULL, "Failed %p\n", wnd);
+ dwnd = CreateWindowA("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
+ DestroyWindow(dwnd);
+ ok(dwnd != NULL, "Failed %p\n", dwnd);
+
+ /* Verify window rect and client rect (they should have the same width and height) */
+ GetWindowRect(wnd, &window_rect);
+ ok(window_rect.left == pos.x, "left is %d instead of %d\n", window_rect.left, pos.x);
+ ok(window_rect.top == pos.y, "top is %d instead of %d\n", window_rect.top, pos.y);
+ ok(window_rect.right == pos.x + width, "right is %d instead of %d\n", window_rect.right, pos.x + width);
+ ok(window_rect.bottom == pos.y + height, "bottom is %d instead of %d\n", window_rect.bottom, pos.y + height);
+ GetClientRect(wnd, &client_rect);
+ ok(client_rect.left == 0, "left is %d instead of 0\n", client_rect.left);
+ ok(client_rect.top == 0, "top is %d instead of 0\n", client_rect.top);
+ ok(client_rect.right == width, "right is %d instead of %d\n", client_rect.right, width);
+ ok(client_rect.bottom == height, "bottom is %d instead of %d\n", client_rect.bottom, height);
+
+ /* Test MapWindowPoints */
+
+ /* MapWindowPoints(NULL or wnd, NULL or wnd, NULL, 1); crashes on Windows */
+
+ SetLastError(0xdeadbeef);
+ n = MapWindowPoints(NULL, NULL, NULL, 0);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ SetLastError(0xdeadbeef);
+ n = MapWindowPoints(wnd, wnd, NULL, 0);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ n = MapWindowPoints(wnd, NULL, NULL, 0);
+ ok(n == MAKELONG(window_rect.left, window_rect.top), "Got %x, expected %x\n",
+ n, MAKELONG(window_rect.left, window_rect.top));
+
+ n = MapWindowPoints(NULL, wnd, NULL, 0);
+ ok(n == MAKELONG(-window_rect.left, -window_rect.top), "Got %x, expected %x\n",
+ n, MAKELONG(-window_rect.left, -window_rect.top));
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(dwnd, NULL, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(dwnd, wnd, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(NULL, dwnd, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(wnd, dwnd, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(dwnd, dwnd, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(NULL, NULL, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ n = MapWindowPoints(wnd, wnd, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %d, expected %d\n", n, 0);
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ p.x = p.y = 100;
+ n = MapWindowPoints(wnd, NULL, &p, 1);
+ ok(n == MAKELONG(window_rect.left, window_rect.top), "Got %x, expected %x\n",
+ n, MAKELONG(window_rect.left, window_rect.top));
+ ok((p.x == (window_rect.left + 100)) && (p.y == (window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
+ p.x, p.y, window_rect.left + 100, window_rect.top + 100);
+
+ p.x = p.y = 100;
+ n = MapWindowPoints(NULL, wnd, &p, 1);
+ ok(n == MAKELONG(-window_rect.left, -window_rect.top), "Got %x, expected %x\n",
+ n, MAKELONG(-window_rect.left, -window_rect.top));
+ ok((p.x == (-window_rect.left + 100)) && (p.y == (-window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
+ p.x, p.y, -window_rect.left + 100, -window_rect.top + 100);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 0;
+ n = MapWindowPoints(wnd0, NULL, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %x, expected 0\n", n);
+ ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 0;
+ n = MapWindowPoints(NULL, wnd0, &p, 1);
+ err = GetLastError();
+ ok(n == 0, "Got %x, expected 0\n", n);
+ ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
+ ok(err == 0xdeadbeef, "Got %x, expected %x\n", err, 0xdeadbeef);
+
+ /* Test ClientToScreen */
+
+ /* ClientToScreen(wnd, NULL); crashes on Windows */
+
+ SetLastError(0xdeadbeef);
+ ret = ClientToScreen(NULL, NULL);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ ret = ClientToScreen(NULL, &p);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ ret = ClientToScreen(dwnd, &p);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ p.x = p.y = 100;
+ ret = ClientToScreen(wnd, &p);
+ ok(ret, "Failed with error %u\n", GetLastError());
+ ok((p.x == (window_rect.left + 100)) && (p.y == (window_rect.top + 100)), "Failed got (%d, %d), expected (%d, %d)\n",
+ p.x, p.y, window_rect.left + 100, window_rect.top + 100);
+
+ p.x = p.y = 0;
+ ret = ClientToScreen(wnd0, &p);
+ ok(ret, "Failed with error %u\n", GetLastError());
+ ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
+
+ /* Test ScreenToClient */
+
+ /* ScreenToClient(wnd, NULL); crashes on Windows */
+
+ SetLastError(0xdeadbeef);
+ ret = ScreenToClient(NULL, NULL);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ ret = ScreenToClient(NULL, &p);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ SetLastError(0xdeadbeef);
+ p.x = p.y = 100;
+ ret = ScreenToClient(dwnd, &p);
+ err = GetLastError();
+ ok(!ret, "Should fail\n");
+ ok(p.x == 100 && p.y == 100, "Failed got(%d, %d), expected (%d, %d)\n", p.x, p.y, 100, 100);
+ ok(err == ERROR_INVALID_WINDOW_HANDLE, "Got %x, expected %x\n", err, ERROR_INVALID_WINDOW_HANDLE);
+
+ p.x = p.y = 100;
+ ret = ScreenToClient(wnd, &p);
+ ok(ret, "Failed with error %u\n", GetLastError());
+ ok((p.x == (-window_rect.left + 100)) && (p.y == (-window_rect.top + 100)), "Failed got(%d, %d), expected (%d, %d)\n",
+ p.x, p.y, -window_rect.left + 100, -window_rect.top + 100);
+
+ p.x = p.y = 0;
+ ret = ScreenToClient(wnd0, &p);
+ ok(ret, "Failed with error %u\n", GetLastError());
+ ok((p.x == 0) && (p.y == 0), "Failed got (%d, %d), expected (0, 0)\n", p.x, p.y);
+
+ DestroyWindow(wnd);
+ 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" );
+ HMODULE gdi32 = GetModuleHandleA("gdi32.dll");
pGetAncestor = (void *)GetProcAddress( user32, "GetAncestor" );
pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" );
pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" );
pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" );
pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
+ pUpdateLayeredWindow = (void *)GetProcAddress( user32, "UpdateLayeredWindow" );
+ pUpdateLayeredWindowIndirect = (void *)GetProcAddress( user32, "UpdateLayeredWindowIndirect" );
pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
+ pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" );
+ pSetProcessDefaultLayout = (void *)GetProcAddress( user32, "SetProcessDefaultLayout" );
+ pFlashWindowEx = (void *)GetProcAddress( user32, "FlashWindowEx" );
+ pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
+ pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );
+ pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" );
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);
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
- 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);
+ /* make sure that these tests are executed first */
+ test_FindWindowEx();
+ test_SetParent();
+
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);
/* Add the tests below this line */
+ test_child_window_from_point();
test_thick_child_size(hwndMain);
test_fullscreen();
test_hwnd_message();
test_capture_2();
test_capture_3(hwndMain, hwndMain2);
test_capture_4();
+ test_rtl_layout();
+ test_FlashWindowEx();
test_CreateWindow();
test_parent_owner();
- test_SetParent();
test_enum_thread_windows();
test_mdi();
test_icons();
- test_SetWindowPos(hwndMain);
+ test_SetWindowPos(hwndMain, hwndMain2);
test_SetMenu(hwndMain);
test_SetFocus(hwndMain);
test_SetActiveWindow(hwndMain);
test_children_zorder(hwndMain);
test_popup_zorder(hwndMain2, hwndMain, WS_POPUP);
test_popup_zorder(hwndMain2, hwndMain, 0);
+ test_GetLastActivePopup();
test_keyboard_input(hwndMain);
test_mouse_input(hwndMain);
test_validatergn(hwndMain);
test_AdjustWindowRect();
test_window_styles();
+ test_dialog_styles();
test_redrawnow();
test_csparentdc();
test_SetWindowLong();
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_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);