* Sync with Wine 1.7.17.
CORE-8080
svn path=/trunk/; revision=62785
static BOOL init_procs(void)
{
WNDCLASSA cls;
- HANDLE user32 = GetModuleHandle("user32");
+ HANDLE user32 = GetModuleHandleA("user32.dll");
pBroadcastA = (PBROADCAST)GetProcAddress(user32, "BroadcastSystemMessageA");
if (!pBroadcastA)
pBroadcastA = (PBROADCAST)GetProcAddress(user32, "BroadcastSystemMessage");
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";
if (!CreateWindowExA(0, "MainWindowClass", "Main window", WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, 100, 100, 200,
- 200, 0, 0, GetModuleHandle(0), NULL))
+ 200, 0, 0, GetModuleHandleA(NULL), NULL))
return FALSE;
return TRUE;
}
ok(!ret || broken(ret), "Returned: %d\n", ret);
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
-#if 0 /* TODO: Check the hang flags */
+if (0) /* TODO: Check the hang flags */
+{
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
-#endif
+}
recips = BSM_APPLICATIONS;
ResetEvent(hevent);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
ok(!ret, "Returned: %d\n", ret);
-#if 0 /* TODO: Check the hang flags */
+if (0) /* TODO: Check the hang flags */
+{
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
+ ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
+ ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
+ ret = broadcastex( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
SetLastError(0xcafebabe);
recips = BSM_APPLICATIONS;
- ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
+ ret = broadcastex( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
ok(0, "Last error: %08x\n", GetLastError());
ok(0, "Returned: %d\n", ret);
-#endif
+}
recips = BSM_APPLICATIONS;
ResetEvent(hevent);
}
static CRITICAL_SECTION clipboard_cs;
+static HWND next_wnd;
static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
switch(msg) {
EnterCriticalSection(&clipboard_cs);
LeaveCriticalSection(&clipboard_cs);
break;
+ case WM_CHANGECBCHAIN:
+ if (next_wnd == (HWND)wp)
+ next_wnd = (HWND)lp;
+ else if (next_wnd)
+ SendMessageA(next_wnd, msg, wp, lp);
+ break;
case WM_USER:
+ ChangeClipboardChain(hwnd, next_wnd);
PostQuitMessage(0);
break;
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static DWORD WINAPI clipboard_thread(void *param)
EnterCriticalSection(&clipboard_cs);
SetLastError(0xdeadbeef);
- SetClipboardViewer(win);
+ next_wnd = SetClipboardViewer(win);
ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError());
LeaveCriticalSection(&clipboard_cs);
ok(r, "CloseClipboard failed: %d\n", GetLastError());
LeaveCriticalSection(&clipboard_cs);
- r = PostMessage(win, WM_USER, 0, 0);
+ r = PostMessageA(win, WM_USER, 0, 0);
ok(r, "PostMessage failed: %d\n", GetLastError());
return 0;
}
static void test_messages(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND win;
MSG msg;
HANDLE thread;
memset(&cls, 0, sizeof(cls));
cls.lpfnWndProc = clipboard_wnd_proc;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.lpszClassName = "clipboard_test";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
- win = CreateWindow("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
+ win = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
ok(win != NULL, "CreateWindow failed: %d\n", GetLastError());
thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid);
ok(thread != NULL, "CreateThread failed: %d\n", GetLastError());
- while(GetMessage(&msg, NULL, 0, 0)) {
+ while(GetMessageA(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(thread);
- UnregisterClass("clipboard_test", GetModuleHandle(0));
+ UnregisterClassA("clipboard_test", GetModuleHandleA(NULL));
DeleteCriticalSection(&clipboard_cs);
}
return 0;
}
-static int is_font_installed(const char *name)
+static BOOL is_font_installed(const char *name)
{
HDC hdc = GetDC(NULL);
BOOL ret = !EnumFontFamiliesA(hdc, name, is_font_installed_proc, 0);
static BOOL (WINAPI *pGetIconInfoExA)(HICON,ICONINFOEXA *);
static BOOL (WINAPI *pGetIconInfoExW)(HICON,ICONINFOEXW *);
-static const int is_win64 = (sizeof(void *) > sizeof(int));
+static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return 0;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static LRESULT CALLBACK callback_parent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void do_child(void)
{
- WNDCLASS class;
+ WNDCLASSA class;
MSG msg;
BOOL ret;
class.lpfnWndProc = callback_child;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
- class.hInstance = GetModuleHandle(NULL);
+ class.hInstance = GetModuleHandleA(NULL);
class.hIcon = NULL;
class.hCursor = NULL;
class.hbrBackground = NULL;
class.lpszClassName = "cursor_child";
SetLastError(0xdeadbeef);
- ret = RegisterClass(&class);
+ ret = RegisterClassA(&class);
ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
/* Create a window. */
ok(child != 0, "CreateWindowA failed. Error: %u\n", GetLastError());
/* Let the parent know our HWND. */
- PostMessage(parent, PROC_INIT, (WPARAM) child, 0);
+ PostMessageA(parent, PROC_INIT, (WPARAM) child, 0);
/* Receive messages. */
- while ((ret = GetMessage(&msg, 0, 0, 0)))
+ while ((ret = GetMessageA(&msg, 0, 0, 0)))
{
ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
}
char path_name[MAX_PATH];
PROCESS_INFORMATION info;
STARTUPINFOA startup;
- WNDCLASS class;
+ WNDCLASSA class;
MSG msg;
BOOL ret;
class.lpfnWndProc = callback_parent;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
- class.hInstance = GetModuleHandle(NULL);
+ class.hInstance = GetModuleHandleA(NULL);
class.hIcon = NULL;
class.hCursor = NULL;
class.hbrBackground = NULL;
class.lpszClassName = "cursor_parent";
SetLastError(0xdeadbeef);
- ret = RegisterClass(&class);
+ ret = RegisterClassA(&class);
ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
/* Create a window. */
child_process = info.hProcess;
/* Wait for child window handle. */
- while ((child == 0) && (ret = GetMessage(&msg, parent, 0, 0)))
+ while ((child == 0) && (ret = GetMessageA(&msg, parent, 0, 0)))
{
ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
}
static void finish_child_process(void)
{
- SendMessage(child, WM_CLOSE, 0, 0);
+ SendMessageA(child, WM_CLOSE, 0, 0);
winetest_wait_child_process( child_process );
CloseHandle(child_process);
}
SetCursor(cursor);
/* Destroy the cursor. */
- SendMessage(child, WM_USER+1, 0, (LPARAM) cursor);
+ SendMessageA(child, WM_USER+1, 0, (LPARAM) cursor);
}
static BOOL color_match(COLORREF a, COLORREF b)
ok(copy != NULL, "CopyImage() failed\n");
if (copy != NULL)
{
- GetObject(bitmap, sizeof(origBitmap), &origBitmap);
- GetObject(copy, sizeof(copyBitmap), ©Bitmap);
+ GetObjectA(bitmap, sizeof(origBitmap), &origBitmap);
+ GetObjectA(copy, sizeof(copyBitmap), ©Bitmap);
orig_is_dib = (origBitmap.bmBits != NULL);
copy_is_dib = (copyBitmap.bmBits != NULL);
/* Check what handle GetCursor() returns if a cursor is not set yet. */
SetLastError(0xdeadbeef);
- cursor2 = LoadCursor(NULL, IDC_WAIT);
+ cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
todo_wine {
ok(cursor == cursor2, "cursor (%p) is not IDC_WAIT (%p).\n", cursor, cursor2);
}
ok_(__FILE__, line)(info.yHotspot == exp_cy/2, "info.yHotspot = %u\n", info.yHotspot);
ok_(__FILE__, line)(info.hbmMask != 0, "info.hbmMask is NULL\n");
- ret = GetObject(info.hbmMask, sizeof(bmMask), &bmMask);
+ ret = GetObjectA(info.hbmMask, sizeof(bmMask), &bmMask);
ok_(__FILE__, line)(ret == sizeof(bmMask), "GetObject(info.hbmMask) failed, ret %u\n", ret);
if (exp_bpp == 1)
display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
ReleaseDC(0, hdc);
- ret = GetObject(info.hbmColor, sizeof(bmColor), &bmColor);
+ ret = GetObjectA(info.hbmColor, sizeof(bmColor), &bmColor);
ok_(__FILE__, line)(ret == sizeof(bmColor), "GetObject(info.hbmColor) failed, ret %u\n", ret);
ok_(__FILE__, line)(bmColor.bmBitsPixel == display_bpp /* XP */ ||
DWORD ret, pixel = 0;
HDC hdc = GetDC(NULL);
- ret = GetObject(hbm, sizeof(bm), &bm);
+ ret = GetObjectA(hbm, sizeof(bm), &bm);
ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
memset(&bmi, 0, sizeof(bmi));
DeleteFileA("icon.ico");
/* Test a system icon */
- handle = LoadIcon( 0, IDI_HAND );
+ handle = LoadIconA( 0, (LPCSTR)IDI_HAND );
ok(handle != NULL, "LoadImage() failed.\n");
if (pGetIconInfoExA)
{
SetPixelV(hdc, 2, 2, background);
/* Let DrawState calculate the size of the icon (it's 1x1) */
- DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags ));
+ DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags ));
result = GetPixel(hdc, 0, 0);
passed[0] = color_match(result, background);
* width/height 2x2 if the icon is only 1x1 pixels in size should
* result in drawing it with size 1x1. The size parameters must be
* ignored if a Icon has to be drawn! */
- DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags ));
+ DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags ));
result = GetPixel(hdc, 0, 0);
passed[1] = color_match(result, background);
/* Set color of the pixel that will be checked afterwards */
SetPixelV(hdc, 1, 1, background);
- DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags ));
+ DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags ));
/* Check the color of the pixel is correct */
result = GetPixel(hdc, 1, 1);
{
HCURSOR ret;
- PeekMessage( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
+ PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
if (parent_id)
{
BOOL ret = AttachThreadInput( GetCurrentThreadId(), parent_id, TRUE );
DWORD count = (DWORD_PTR)arg;
int ret;
- PeekMessage( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
+ PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
if (parent_id)
{
BOOL ret = AttachThreadInput( GetCurrentThreadId(), parent_id, TRUE );
ok( info.flags & CURSOR_SHOWING, "cursor not shown in info\n" );
}
- event_start = CreateEvent( NULL, FALSE, FALSE, NULL );
- event_next = CreateEvent( NULL, FALSE, FALSE, NULL );
+ event_start = CreateEventW( NULL, FALSE, FALSE, NULL );
+ event_next = CreateEventW( NULL, FALSE, FALSE, NULL );
count = ShowCursor( TRUE );
ok( count == 1, "wrong count %d\n", count );
DeleteObject(cursorInfo.hbmColor);
/* Try testing DestroyCursor() now using LoadCursor() cursors. */
- cursor = LoadCursor(NULL, IDC_ARROW);
+ cursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
SetLastError(0xdeadbeef);
ret = DestroyCursor(cursor);
ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
/* Check if LoadCursor() returns the same handle with the same icon. */
- cursor2 = LoadCursor(NULL, IDC_ARROW);
+ cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
ok(cursor2 == cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
/* Check if LoadCursor() returns the same handle with a different icon. */
- cursor2 = LoadCursor(NULL, IDC_WAIT);
+ cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
ok(cursor2 != cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
}
{
HDC hdc, old_hdc;
HDC hdcs[20];
- INT i, rop, def_rop, found_dc;
+ INT i, rop, def_rop;
+ BOOL found_dc;
/* test cache DC */
ReleaseDC( hwnd_cache, hdc );
old_hdc = hdc;
- found_dc = 0;
+ found_dc = FALSE;
for (i = 0; i < 20; i++)
{
hdc = hdcs[i] = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
ok( rop == def_rop, "wrong ROP2 %d after release %p/%p\n", rop, old_hdc, hdc );
if (hdc == old_hdc)
{
- found_dc = 1;
+ found_dc = TRUE;
SetROP2( hdc, R2_WHITE );
}
}
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 = "cache_class";
char str[MAX_PATH];
static int msg_index = 0;
static HCONV conversation = 0;
- static char test_service [] = "TestDDEService";
- static char test_topic [] = "TestDDETopic";
+ static const char test_service [] = "TestDDEService";
+ static const char test_topic [] = "TestDDETopic";
msg_index++;
HSZ server, topic;
HCONV hconv;
HDDEDATA hdata;
- static char test_service[] = "TestDDEService";
- static WCHAR test_service_w[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0};
- static char test_topic[] = "TestDDETopic";
- static WCHAR test_topic_w[] = {'T','e','s','t','D','D','E','T','o','p','i','c',0};
+ static const char test_service[] = "TestDDEService";
+ static const WCHAR test_service_w[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0};
+ static const char test_topic[] = "TestDDETopic";
+ static const WCHAR test_topic_w[] = {'T','e','s','t','D','D','E','T','o','p','i','c',0};
trace("Start end to end client %s\n", type_a ? "ASCII" : "UNICODE");
BOOL ret;
DWORD res;
HDDEDATA hdata;
- static CHAR test_service[] = "TestDDEService";
+ static const char test_service[] = "TestDDEService";
trace("start end to end server %s\n", type_a ? "ASCII" : "UNICODE");
server_pid = 0;
static LONG g_styleInitialFocusT1, g_styleInitialFocusT2;
static BOOL g_bInitialFocusInitDlgResult, g_bReceivedCommand;
-static int g_terminated;
+static BOOL g_terminated;
typedef struct {
INT_PTR id;
if (winetest_debug > 1)
trace("======== key stroke sequence #%d: %s =============\n",
seqnr + 1, buf);
- while( PeekMessage(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) {
+ while( PeekMessageA(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) {
if (winetest_debug > 1)
trace("message[%d] %-15s wParam %04lx lParam %08lx time %x\n", i,
MSGNAME[msg.message - WM_KEYFIRST], msg.wParam, msg.lParam, msg.time);
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
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( NULL, (LPCSTR)IDC_ARROW );
wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
UpdateWindow( hWndTest);
/* flush pending messages */
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
SetFocus( hWndTest );
TestSysKeys( hWndTest );
while (diff > 0)
{
if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (is_keyboard_message(msg.message) || is_mouse_message(msg.message))
ok(msg.time != 0, "message %#x has time set to 0\n", msg.message);
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
diff = time - GetTickCount();
}
} sendinput_test[] = {
/* test ALT+F */
/* 0 */
- {VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
+ {VK_LMENU, 0, FALSE, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam, VK_LMENU}, {WM_SYSKEYDOWN}, {0}}},
- {'F', 0, 0, {{'F', 0x00}, {0}},
+ {'F', 0, FALSE, {{'F', 0x00}, {0}},
{{WM_SYSKEYDOWN, hook}, {WM_SYSKEYDOWN},
{WM_SYSCHAR},
{WM_SYSCOMMAND}, {0}}},
- {'F', KEYEVENTF_KEYUP, 0, {{'F', 0x80}, {0}},
+ {'F', KEYEVENTF_KEYUP, FALSE, {{'F', 0x80}, {0}},
{{WM_SYSKEYUP, hook}, {WM_SYSKEYUP}, {0}}},
- {VK_LMENU, KEYEVENTF_KEYUP, 0, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
+ {VK_LMENU, KEYEVENTF_KEYUP, FALSE, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test CTRL+O */
/* 4 */
- {VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
+ {VK_LCONTROL, 0, FALSE, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
- {'O', 0, 0, {{'O', 0x00}, {0}},
+ {'O', 0, FALSE, {{'O', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {WM_CHAR}, {0}}},
- {'O', KEYEVENTF_KEYUP, 0, {{'O', 0x80}, {0}},
+ {'O', KEYEVENTF_KEYUP, FALSE, {{'O', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
- {VK_LCONTROL, KEYEVENTF_KEYUP, 0, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
+ {VK_LCONTROL, KEYEVENTF_KEYUP, FALSE, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test ALT+CTRL+X */
/* 8 */
- {VK_LMENU, 0, 0, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
+ {VK_LMENU, 0, FALSE, {{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook}, {WM_SYSKEYDOWN}, {0}}},
- {VK_LCONTROL, 0, 0, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
+ {VK_LCONTROL, 0, FALSE, {{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
- {'X', 0, 0, {{'X', 0x00}, {0}},
+ {'X', 0, FALSE, {{'X', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
- {'X', KEYEVENTF_KEYUP, 0, {{'X', 0x80}, {0}},
+ {'X', KEYEVENTF_KEYUP, FALSE, {{'X', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
- {VK_LCONTROL, KEYEVENTF_KEYUP, 0, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
+ {VK_LCONTROL, KEYEVENTF_KEYUP, FALSE, {{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_SYSKEYUP, hook}, {WM_SYSKEYUP}, {0}}},
- {VK_LMENU, KEYEVENTF_KEYUP, 0, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
+ {VK_LMENU, KEYEVENTF_KEYUP, FALSE, {{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test SHIFT+A */
/* 14 */
- {VK_LSHIFT, 0, 0, {{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
+ {VK_LSHIFT, 0, FALSE, {{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {0}}},
- {'A', 0, 0, {{'A', 0x00}, {0}},
+ {'A', 0, FALSE, {{'A', 0x00}, {0}},
{{WM_KEYDOWN, hook}, {WM_KEYDOWN}, {WM_CHAR}, {0}}},
- {'A', KEYEVENTF_KEYUP, 0, {{'A', 0x80}, {0}},
+ {'A', KEYEVENTF_KEYUP, FALSE, {{'A', 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
- {VK_LSHIFT, KEYEVENTF_KEYUP, 0, {{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
+ {VK_LSHIFT, KEYEVENTF_KEYUP, FALSE, {{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook}, {WM_KEYUP}, {0}}},
/* test L-SHIFT & R-SHIFT: */
/* RSHIFT == LSHIFT */
/* 18 */
- {VK_RSHIFT, 0, 0,
+ {VK_RSHIFT, 0, FALSE,
/* recent windows versions (>= w2k3) correctly report an RSHIFT transition */
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00, TRUE}, {VK_RSHIFT, 0x00, TRUE}, {0}},
{{WM_KEYDOWN, hook|wparam, VK_RSHIFT},
{WM_KEYDOWN}, {0}}},
- {VK_RSHIFT, KEYEVENTF_KEYUP, 0,
+ {VK_RSHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80, TRUE}, {VK_RSHIFT, 0x80, TRUE}, {0}},
{{WM_KEYUP, hook, hook|wparam, VK_RSHIFT},
{WM_KEYUP}, {0}}},
/* LSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 20 */
- {VK_LSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_LSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_LSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_LSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* RSHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 22 */
- {VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
*/
/* SHIFT == LSHIFT */
/* 24 */
- {VK_SHIFT, 0, 0,
+ {VK_SHIFT, 0, FALSE,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/* |wparam */|lparam, VK_SHIFT, 0},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_SHIFT, KEYEVENTF_KEYUP, 0,
+ {VK_SHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_UP},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* SHIFT | KEYEVENTF_EXTENDEDKEY == RSHIFT */
/* 26 */
- {VK_SHIFT, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_SHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x00}, {VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_SHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_SHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_SHIFT, 0x80}, {VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_SHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
/* test L-CONTROL & R-CONTROL: */
/* RCONTROL == LCONTROL */
/* 28 */
- {VK_RCONTROL, 0, 0,
+ {VK_RCONTROL, 0, FALSE,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam, VK_RCONTROL},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, 0}, {0}}},
- {VK_RCONTROL, KEYEVENTF_KEYUP, 0,
+ {VK_RCONTROL, KEYEVENTF_KEYUP, FALSE,
{{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam, VK_RCONTROL},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* LCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 30 */
- {VK_LCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_LCONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LCONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
- {VK_LCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_LCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* RCONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 32 */
- {VK_RCONTROL, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RCONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RCONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
- {VK_RCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RCONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RCONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* CONTROL == LCONTROL */
/* 34 */
- {VK_CONTROL, 0, 0,
+ {VK_CONTROL, 0, FALSE,
{{VK_CONTROL, 0x00}, {VK_LCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam, VK_CONTROL*/},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, 0}, {0}}},
- {VK_CONTROL, KEYEVENTF_KEYUP, 0,
+ {VK_CONTROL, KEYEVENTF_KEYUP, FALSE,
{{VK_CONTROL, 0x80}, {VK_LCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam, VK_CONTROL*/},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP}, {0}}},
/* CONTROL | KEYEVENTF_EXTENDEDKEY == RCONTROL */
/* 36 */
- {VK_CONTROL, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_CONTROL, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x00}, {VK_RCONTROL, 0x00}, {0}},
{{WM_KEYDOWN, hook/*|wparam*/|lparam, VK_CONTROL, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_CONTROL, KF_EXTENDED}, {0}}},
- {VK_CONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_CONTROL, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_CONTROL, 0x80}, {VK_RCONTROL, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam*/|lparam, VK_CONTROL, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, wparam|lparam, VK_CONTROL, KF_UP|KF_EXTENDED}, {0}}},
/* test L-MENU & R-MENU: */
/* RMENU == LMENU */
/* 38 */
- {VK_RMENU, 0, 0,
+ {VK_RMENU, 0, FALSE,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|optional, VK_LCONTROL},
{WM_SYSKEYDOWN, hook|wparam, VK_RMENU},
{WM_KEYDOWN, wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0}, {0}}},
- {VK_RMENU, KEYEVENTF_KEYUP, 1,
+ {VK_RMENU, KEYEVENTF_KEYUP, TRUE,
{{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|optional, VK_LCONTROL},
{WM_KEYUP, hook|wparam, VK_RMENU},
{WM_SYSCOMMAND, optional}, {0}}},
/* LMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 40 */
- {VK_LMENU, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_LMENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam, VK_LMENU, LLKHF_EXTENDED},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
- {VK_LMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
+ {VK_LMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_LMENU, LLKHF_UP|LLKHF_EXTENDED},
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP|KF_EXTENDED},
{WM_SYSCOMMAND}, {0}}},
/* RMENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 42 */
- {VK_RMENU, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RMENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam|optional, VK_LCONTROL, 0},
{WM_SYSKEYDOWN, hook|wparam|lparam, VK_RMENU, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
- {VK_RMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
+ {VK_RMENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|lparam|optional, VK_LCONTROL, LLKHF_UP},
{WM_KEYUP, hook|wparam|lparam, VK_RMENU, LLKHF_UP|LLKHF_EXTENDED},
{WM_SYSCOMMAND, optional}, {0}}},
/* MENU == LMENU */
/* 44 */
- {VK_MENU, 0, 0,
+ {VK_MENU, 0, FALSE,
{{VK_MENU, 0x00}, {VK_LMENU, 0x00}, {0}},
{{WM_SYSKEYDOWN, hook/*|wparam, VK_MENU*/},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, 0}, {0}}},
- {VK_MENU, KEYEVENTF_KEYUP, 1,
+ {VK_MENU, KEYEVENTF_KEYUP, TRUE,
{{VK_MENU, 0x80}, {VK_LMENU, 0x80}, {0}},
{{WM_KEYUP, hook/*|wparam, VK_MENU*/},
{WM_SYSKEYUP, wparam|lparam, VK_MENU, KF_UP},
{WM_SYSCOMMAND}, {0}}},
/* MENU | KEYEVENTF_EXTENDEDKEY == RMENU */
/* 46 */
- {VK_MENU, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_MENU, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_MENU, 0x00}, {VK_RMENU, 0x00}, {VK_CONTROL, 0x00, 1}, {VK_LCONTROL, 0x01, 1}, {0}},
{{WM_SYSKEYDOWN, hook|wparam|lparam|optional, VK_CONTROL, 0},
{WM_SYSKEYDOWN, hook/*|wparam*/|lparam, VK_MENU, LLKHF_EXTENDED},
{WM_SYSKEYDOWN, wparam|lparam, VK_MENU, KF_EXTENDED}, {0}}},
- {VK_MENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 1,
+ {VK_MENU, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, TRUE,
{{VK_MENU, 0x80}, {VK_RMENU, 0x80}, {VK_CONTROL, 0x81, 1}, {VK_LCONTROL, 0x80, 1}, {0}},
{{WM_KEYUP, hook|wparam|lparam|optional, VK_CONTROL, LLKHF_UP},
{WM_KEYUP, hook/*|wparam*/|lparam, VK_MENU, LLKHF_UP|LLKHF_EXTENDED},
/* test LSHIFT & RSHIFT */
/* 48 */
- {VK_LSHIFT, 0, 0,
+ {VK_LSHIFT, 0, FALSE,
{{VK_SHIFT, 0x00}, {VK_LSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_LSHIFT, 0},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RSHIFT, KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_RSHIFT, 0x00}, {0}},
{{WM_KEYDOWN, hook|wparam|lparam, VK_RSHIFT, LLKHF_EXTENDED},
{WM_KEYDOWN, wparam|lparam, VK_SHIFT, 0}, {0}}},
- {VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, 0,
+ {VK_RSHIFT, KEYEVENTF_KEYUP | KEYEVENTF_EXTENDEDKEY, FALSE,
{{VK_RSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam|lparam, VK_RSHIFT, LLKHF_UP|LLKHF_EXTENDED},
{WM_KEYUP, optional}, {0}}},
- {VK_LSHIFT, KEYEVENTF_KEYUP, 0,
+ {VK_LSHIFT, KEYEVENTF_KEYUP, FALSE,
{{VK_SHIFT, 0x80}, {VK_LSHIFT, 0x80}, {0}},
{{WM_KEYUP, hook|wparam, VK_LSHIFT},
{WM_KEYUP, wparam|lparam, VK_SHIFT, KF_UP}, {0}}},
- {0, 0, 0, {{0}}, {{0}}} /* end */
+ {0, 0, FALSE, {{0}}, {{0}}} /* end */
};
static struct message sent_messages[MAXKEYMESSAGES];
const struct message *expected = test->expected_messages;
while (t->wVk) {
- int matched = ((ks1[t->wVk]&0x80) == (t->before_state&0x80)
+ BOOL matched = ((ks1[t->wVk]&0x80) == (t->before_state&0x80)
&& (ks2[t->wVk]&0x80) == (~t->before_state&0x80));
if (!matched && !t->optional && test->_todo_wine)
sent_messages[sent_messages_cnt++].lParam = HIWORD(lParam) & (KF_UP|KF_EXTENDED);
}
}
- return DefWindowProc(hWnd, Msg, wParam, lParam);
+ return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
static LRESULT CALLBACK hook_proc(int code, WPARAM wparam, LPARAM lparam)
skip("Skipping Input_blackbox test on non-US keyboard\n");
return;
}
- window = CreateWindow("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL
+ window = CreateWindowA("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL
|WS_VISIBLE, 0, 0, 200, 60, NULL, NULL,
NULL, NULL);
ok(window != NULL, "error: %d\n", (int) GetLastError());
* key state set by SendInput(). */
empty_message_queue();
- prevWndProc = SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR) WndProc2);
+ prevWndProc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR) WndProc2);
ok(prevWndProc != 0 || (prevWndProc == 0 && GetLastError() == 0),
"error: %d\n", (int) GetLastError());
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = unicode_wnd_proc;
wclass.hInstance = hInstance;
- wclass.hIcon = LoadIcon(0, IDI_APPLICATION);
- wclass.hCursor = LoadCursor( NULL, IDC_ARROW);
+ wclass.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
+ wclass.hCursor = LoadCursorW( NULL, (LPCWSTR)IDC_ARROW);
wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
return;
}
- hModuleImm32 = LoadLibrary("imm32.dll");
+ hModuleImm32 = LoadLibraryA("imm32.dll");
if (hModuleImm32) {
pImmDisableIME = (void *)GetProcAddress(hModuleImm32, "ImmDisableIME");
if (pImmDisableIME)
RECT rc;
GetCursorPos(&pt_org);
- hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
10, 10, 200, 200, NULL, NULL, NULL, NULL);
SetCursorPos(100, 100);
{ VK_NUMPAD9, VK_PRIOR },
};
- s = MapVirtualKeyEx(VK_SHIFT, MAPVK_VK_TO_VSC, kl);
+ s = MapVirtualKeyExA(VK_SHIFT, MAPVK_VK_TO_VSC, kl);
ok(s != 0, "MapVirtualKeyEx(VK_SHIFT) should return non-zero\n");
- sL = MapVirtualKeyEx(VK_LSHIFT, MAPVK_VK_TO_VSC, kl);
+ sL = MapVirtualKeyExA(VK_LSHIFT, MAPVK_VK_TO_VSC, kl);
ok(s == sL || broken(sL == 0), /* win9x */
"%x != %x\n", s, sL);
- kL = MapVirtualKeyEx(0x2a, MAPVK_VSC_TO_VK, kl);
+ kL = MapVirtualKeyExA(0x2a, MAPVK_VSC_TO_VK, kl);
ok(kL == VK_SHIFT, "Scan code -> vKey = %x (not VK_SHIFT)\n", kL);
- kR = MapVirtualKeyEx(0x36, MAPVK_VSC_TO_VK, kl);
+ kR = MapVirtualKeyExA(0x36, MAPVK_VSC_TO_VK, kl);
ok(kR == VK_SHIFT, "Scan code -> vKey = %x (not VK_SHIFT)\n", kR);
- kL = MapVirtualKeyEx(0x2a, MAPVK_VSC_TO_VK_EX, kl);
+ kL = MapVirtualKeyExA(0x2a, MAPVK_VSC_TO_VK_EX, kl);
ok(kL == VK_LSHIFT || broken(kL == 0), /* win9x */
"Scan code -> vKey = %x (not VK_LSHIFT)\n", kL);
- kR = MapVirtualKeyEx(0x36, MAPVK_VSC_TO_VK_EX, kl);
+ kR = MapVirtualKeyExA(0x36, MAPVK_VSC_TO_VK_EX, kl);
ok(kR == VK_RSHIFT || broken(kR == 0), /* win9x */
"Scan code -> vKey = %x (not VK_RSHIFT)\n", kR);
/* test that MAPVK_VSC_TO_VK prefers the non-numpad vkey if there's ambiguity */
for (i = 0; i < sizeof(numpad_collisions)/sizeof(numpad_collisions[0]); i++)
{
- UINT numpad_scan = MapVirtualKeyEx(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
- UINT other_scan = MapVirtualKeyEx(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
+ UINT numpad_scan = MapVirtualKeyExA(numpad_collisions[i][0], MAPVK_VK_TO_VSC, kl);
+ UINT other_scan = MapVirtualKeyExA(numpad_collisions[i][1], MAPVK_VK_TO_VSC, kl);
/* do they really collide for this layout? */
if (numpad_scan && other_scan == numpad_scan)
{
- UINT vkey = MapVirtualKeyEx(numpad_scan, MAPVK_VSC_TO_VK, kl);
+ UINT vkey = MapVirtualKeyExA(numpad_scan, MAPVK_VSC_TO_VK, kl);
ok(vkey != numpad_collisions[i][0],
"Got numpad vKey %x for scan code %x when there was another choice\n",
vkey, numpad_scan);
static BOOL correct_behavior(void)
{
HMENU hmenu;
- MENUITEMINFO info;
+ MENUITEMINFOA info;
BOOL rc;
hmenu = CreateMenu();
- memset(&info, 0, sizeof(MENUITEMINFO));
- info.cbSize= sizeof(MENUITEMINFO);
+ memset(&info, 0, sizeof(MENUITEMINFOA));
+ info.cbSize= sizeof(MENUITEMINFOA);
SetLastError(0xdeadbeef);
- rc = GetMenuItemInfo(hmenu, 0, TRUE, &info);
+ rc = GetMenuItemInfoA(hmenu, 0, TRUE, &info);
/* Win9x : 0xdeadbeef
* NT4 : ERROR_INVALID_PARAMETER
* >= W2K : ERROR_MENU_ITEM_NOT_FOUND
{
case WM_ENTERMENULOOP:
/* mark window as having entered menu loop */
- SetWindowLongPtr(hwnd, GWLP_USERDATA, TRUE);
+ SetWindowLongPtrA(hwnd, GWLP_USERDATA, TRUE);
/* exit menu modal loop
* ( A SendMessage does not work on NT3.51 here ) */
- return PostMessage(hwnd, WM_CANCELMODE, 0, 0);
+ return PostMessageA(hwnd, WM_CANCELMODE, 0, 0);
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
/* The MSVC headers ignore our NONAMELESSUNION requests so we have to define
static int MOD_odheight;
static SIZE MODsizes[MOD_NRMENUS]= { {MOD_SIZE, MOD_SIZE},{MOD_SIZE, MOD_SIZE},
{MOD_SIZE, MOD_SIZE},{MOD_SIZE, MOD_SIZE}};
-static int MOD_GotDrawItemMsg = FALSE;
+static BOOL MOD_GotDrawItemMsg = FALSE;
static int gflag_initmenupopup,
gflag_entermenuloop,
- gflag_initmenu;
+ gflag_initmenu,
+ gflag_enteridle;
+static WPARAM selectitem_wp;
+static LPARAM selectitem_lp;
/* wndproc used by test_menu_ownerdraw() */
static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
case WM_DRAWITEM:
{
DRAWITEMSTRUCT * pdis;
- TEXTMETRIC tm;
+ TEXTMETRICA tm;
HPEN oldpen;
char chrs[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
SIZE sz;
strcpy( buf, MOD_txtsizes[i].text);
if( ( p = strchr( buf, '\t'))) {
*p = '\0';
- DrawText( pdis->hDC, p + 1, -1, &rc,
+ DrawTextA( pdis->hDC, p + 1, -1, &rc,
DT_SINGLELINE|DT_CALCRECT);
MOD_txtsizes[i].sc_size.cx= rc.right - rc.left;
MOD_txtsizes[i].sc_size.cy= rc.bottom - rc.top;
}
- DrawText( pdis->hDC, buf, -1, &rc,
+ DrawTextA( pdis->hDC, buf, -1, &rc,
DT_SINGLELINE|DT_CALCRECT);
MOD_txtsizes[i].size.cx= rc.right - rc.left;
MOD_txtsizes[i].size.cy= rc.bottom - rc.top;
/* store the rectangle */
MOD_rc[pdis->itemData] = pdis->rcItem;
/* calculate average character width */
- GetTextExtentPoint( pdis->hDC, chrs, 52, &sz );
+ GetTextExtentPointA( pdis->hDC, chrs, 52, &sz );
MOD_avec = (sz.cx + 26)/52;
- GetTextMetrics( pdis->hDC, &tm);
+ GetTextMetricsA( pdis->hDC, &tm);
MOD_hic = tm.tmHeight;
MOD_GotDrawItemMsg = TRUE;
return TRUE;
}
case WM_ENTERIDLE:
{
+ gflag_enteridle++;
ok( lparam || broken(!lparam), /* win9x, nt4 */
"Menu window handle is NULL!\n");
if( lparam) {
ok( hmenupopup == hmenu, "MN_GETHMENU returns %p expected %p\n",
hmenu, hmenupopup);
}
- PostMessage(hwnd, WM_CANCELMODE, 0, 0);
+ PostMessageA(hwnd, WM_CANCELMODE, 0, 0);
return TRUE;
}
-
+ case WM_MENUSELECT:
+ selectitem_wp = wparam;
+ selectitem_lp = lparam;
+ break;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void register_menu_check_class(void)
{
- WNDCLASS wc =
+ WNDCLASSA wc =
{
0,
menu_check_wnd_proc,
0,
0,
- GetModuleHandle(NULL),
+ GetModuleHandleA(NULL),
NULL,
- LoadCursor(NULL, IDC_ARROW),
+ LoadCursorA(NULL, (LPCSTR)IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE+1),
NULL,
- TEXT("WineMenuCheck"),
+ "WineMenuCheck",
};
-
- atomMenuCheckClass = RegisterClass(&wc);
+
+ atomMenuCheckClass = RegisterClassA(&wc);
}
static void test_getmenubarinfo(void)
mbi.cbSize = sizeof(MENUBARINFO);
- hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_SYSMENU | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
ok(mbi.fFocused == 0, "fFocused: Got %d instead of 0.\n", mbi.fFocused);
/* add some items */
- ret = AppendMenu(hmenu, MF_STRING , 100, "item 1");
+ ret = AppendMenuA(hmenu, MF_STRING , 100, "item 1");
ok(ret, "AppendMenu failed.\n");
- ret = AppendMenu(hmenu, MF_STRING , 101, "item 2");
+ ret = AppendMenuA(hmenu, MF_STRING , 101, "item 2");
ok(ret, "AppendMenu failed.\n");
ret = SetMenu(hwnd, hmenu);
ok(ret, "SetMenu failed with error %d\n", GetLastError());
{
BOOL ret;
HMENU hmenu;
- HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
hmenu = CreateMenu();
ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
- ret = InsertMenu(hmenu, 0, MF_STRING, 0, TEXT("&Test"));
+ ret = InsertMenuA(hmenu, 0, MF_STRING, 0, "&Test");
ok(ret, "InsertMenu failed with error %d\n", GetLastError());
ret = SetMenu(hwnd, hmenu);
ok(ret, "SetMenu failed with error %d\n", GetLastError());
ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
ret = DrawMenuBar(hwnd);
- todo_wine {
ok(ret, "DrawMenuBar failed with error %d\n", GetLastError());
- }
ret = IsMenu(GetMenu(hwnd));
ok(!ret || broken(ret) /* nt4 */, "Menu handle should have been destroyed\n");
- SendMessage(hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
+ SendMessageA(hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
/* did we process the WM_INITMENU message? */
- ret = GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ ret = GetWindowLongPtrA(hwnd, GWLP_USERDATA);
todo_wine {
ok(ret, "WM_INITMENU should have been sent\n");
}
case WM_ENTERIDLE:
hwndmenu = GetCapture();
if( hwndmenu) {
- PostMessage( hwndmenu, WM_KEYDOWN, VK_DOWN, 0);
- PostMessage( hwndmenu, WM_KEYDOWN, VK_RIGHT, 0);
- PostMessage( hwndmenu, WM_KEYDOWN, VK_RETURN, 0);
+ PostMessageA( hwndmenu, WM_KEYDOWN, VK_DOWN, 0);
+ PostMessageA( hwndmenu, WM_KEYDOWN, VK_RIGHT, 0);
+ PostMessageA( hwndmenu, WM_KEYDOWN, VK_RETURN, 0);
}
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void test_subpopup_locked_by_menu(void)
BOOL ret;
HMENU hmenu, hsubmenu;
MENUINFO mi = { sizeof( MENUINFO)};
- MENUITEMINFO mii = { sizeof( MENUITEMINFO)};
+ MENUITEMINFOA mii = { sizeof( MENUITEMINFOA)};
HWND hwnd;
const int itemid = 0x1234567;
if( !pGetMenuInfo)
return;
}
/* create window, popupmenu with one subpopup */
- hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR) subpopuplocked_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR) subpopuplocked_wnd_proc);
hmenu = CreatePopupMenu();
ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
hsubmenu = CreatePopupMenu();
ok(hsubmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
- ret = InsertMenu(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hsubmenu,
- TEXT("PopUpLockTest"));
+ ret = InsertMenuA(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hsubmenu,
+ "PopUpLockTest");
ok(ret, "InsertMenu failed with error %d\n", GetLastError());
- ret = InsertMenu(hsubmenu, 0, MF_BYPOSITION | MF_STRING, itemid, TEXT("PopUpMenu"));
+ ret = InsertMenuA(hsubmenu, 0, MF_BYPOSITION | MF_STRING, itemid, "PopUpMenu");
ok(ret, "InsertMenu failed with error %d\n", GetLastError());
/* first some tests that all this functions properly */
mii.fMask = MIIM_SUBMENU;
- ret = GetMenuItemInfo( hmenu, 0, TRUE, &mii);
+ ret = GetMenuItemInfoA( hmenu, 0, TRUE, &mii);
ok( ret, "GetMenuItemInfo failed error %d\n", GetLastError());
ok( mii.hSubMenu == hsubmenu, "submenu is %p\n", mii.hSubMenu);
mi.fMask |= MIM_STYLE;
ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
/* and repeat the tests */
mii.fMask = MIIM_SUBMENU;
- ret = GetMenuItemInfo( hmenu, 0, TRUE, &mii);
+ ret = GetMenuItemInfoA( hmenu, 0, TRUE, &mii);
ok( ret, "GetMenuItemInfo failed error %d\n", GetLastError());
/* GetMenuInfo fails now */
ok( mii.hSubMenu == hsubmenu, "submenu is %p\n", mii.hSubMenu);
int i,j,k;
BOOL ret;
HMENU hmenu;
- MENUITEMINFO mii;
+ MENUITEMINFOA mii;
LONG leftcol;
- HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
if( !hwnd) return;
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
hmenu = CreatePopupMenu();
ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
if( !hmenu) { DestroyWindow(hwnd);return;}
k=0;
for( j=0;j<2;j++) /* create columns */
for(i=0;i<2;i++) { /* create rows */
- ret = AppendMenu( hmenu, MF_OWNERDRAW |
- (i==0 ? MF_MENUBREAK : 0), k, MAKEINTRESOURCE(k));
+ ret = AppendMenuA( hmenu, MF_OWNERDRAW |
+ (i==0 ? MF_MENUBREAK : 0), k, (LPCSTR)MAKEINTRESOURCE(k));
k++;
ok( ret, "AppendMenu failed for %d\n", k-1);
}
/* test what MF_MENUBREAK did at the first position. Also show
* that an MF_SEPARATOR is ignored in the height calculation. */
leftcol= MOD_rc[0].left;
- ModifyMenu( hmenu, 0, MF_BYCOMMAND| MF_OWNERDRAW| MF_SEPARATOR, 0, 0);
+ ModifyMenuA( hmenu, 0, MF_BYCOMMAND| MF_OWNERDRAW| MF_SEPARATOR, 0, 0);
/* display the menu */
TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
/* left should be 4 pixels less now */
MOD_rc[0].bottom - MOD_rc[0].top, MOD_SIZE);
/* test owner-drawn callback bitmap */
- ModifyMenu( hmenu, 1, MF_BYPOSITION | MFT_BITMAP, 1, (LPCSTR)HBMMENU_CALLBACK );
+ ModifyMenuA( hmenu, 1, MF_BYPOSITION | MFT_BITMAP, 1, (LPCSTR)HBMMENU_CALLBACK );
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_BITMAP | MIIM_FTYPE | MIIM_ID;
if (GetMenuItemInfoA( hmenu, 1, TRUE, &mii ))
if( !hmenu) { DestroyWindow(hwnd);return;}
MOD_maxid=1;
for(i=0;i<2;i++) {
- ret = AppendMenu( hmenu, MF_OWNERDRAW , i, 0);
+ ret = AppendMenuA( hmenu, MF_OWNERDRAW, i, 0 );
ok( ret, "AppendMenu failed for %d\n", i);
}
ret = SetMenu( hwnd, hmenu);
{
BOOL ret;
HMENU hmenu, submenu;
- MENUITEMINFO mii={ sizeof( MENUITEMINFO )};
+ MENUITEMINFOA mii={ sizeof( MENUITEMINFOA )};
MENUINFO mi;
RECT rc;
CHAR text_copy[16];
int hastab, expect;
- int failed = 0;
+ BOOL failed = FALSE;
MOD_GotDrawItemMsg = FALSE;
mii.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_STATE;
ret = pSetMenuInfo( hmenu, &mi);
ok( ret, "SetMenuInfo failed with error %d\n", GetLastError());
}
- ret = InsertMenuItem( hmenu, 0, FALSE, &mii);
+ ret = InsertMenuItemA( hmenu, 0, FALSE, &mii);
ok( ret, "InsertMenuItem failed with error %d\n", GetLastError());
failed = !ret;
if( winetest_debug) {
sprintf( buf,"%d text \"%s\" mnuopt %d", count, text ? text: "(nil)", mnuopt);
FillRect( hdc, &rc, (HBRUSH) COLOR_WINDOW);
- TextOut( hdc, 10, 50, buf, strlen( buf));
+ TextOutA( hdc, 10, 50, buf, strlen( buf));
ReleaseDC( hwnd, hdc);
}
if(ispop)
}
memset( bmfill, 0xcc, sizeof( bmfill));
- hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL, WS_SYSMENU |
+ hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL, WS_SYSMENU |
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
- hbm_arrow=LoadBitmap( 0, (CHAR*)OBM_MNARROW);
- GetObject( hbm_arrow, sizeof(bm), &bm);
+ hbm_arrow = LoadBitmapA( 0, (LPCSTR)OBM_MNARROW);
+ GetObjectA( hbm_arrow, sizeof(bm), &bm);
arrowwidth = bm.bmWidth;
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
if( !hwnd) return;
ok( HBMMENU_POPUP_CLOSE == mii.hbmpItem, "Item info did not get the right hbitmap: got %p expected %p\n",
mii.hbmpItem, HBMMENU_POPUP_CLOSE);
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
if( winetest_debug)
trace(" check %d,%d arrow %d avechar %d\n",
static void test_menu_add_string( void )
{
HMENU hmenu;
- MENUITEMINFO info;
+ MENUITEMINFOA info;
BOOL rc;
int ret;
info.dwItemData = 0;
info.wID = 1;
info.fState = 0;
- InsertMenuItem(hmenu, 0, TRUE, &info );
+ InsertMenuItemA(hmenu, 0, TRUE, &info );
memset( &info, 0, sizeof info );
info.cbSize = sizeof info;
info.dwTypeData = string;
info.cch = sizeof string;
string[0] = 0;
- GetMenuItemInfo( hmenu, 0, TRUE, &info );
+ GetMenuItemInfoA( hmenu, 0, TRUE, &info );
ok( !strcmp( string, "blah" ), "menu item name differed\n");
/* Test combination of ownerdraw and strings with GetMenuItemString(A/W) */
strcpy(string, "Dummy string");
memset(&info, 0x00, sizeof(info));
- info.cbSize= sizeof(MENUITEMINFO);
+ info.cbSize= sizeof(MENUITEMINFOA);
info.fMask= MIIM_FTYPE | MIIM_STRING; /* Set OwnerDraw + typeData */
info.fType= MFT_OWNERDRAW;
info.dwTypeData= string;
- rc = InsertMenuItem( hmenu, 0, TRUE, &info );
+ rc = InsertMenuItemA( hmenu, 0, TRUE, &info );
ok (rc, "InsertMenuItem failed\n");
strcpy(string,"Garbage");
- ok (GetMenuString( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
+ ok (GetMenuStringA( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
ok (!strcmp( strback, "Dummy string" ), "Menu text from Ansi version incorrect\n");
SetLastError(0xdeadbeef);
ok (!lstrcmpW( strbackW, expectedString ), "Menu text from Unicode version incorrect\n");
}
+ /* Just try some invalid parameter tests */
+ SetLastError(0xdeadbeef);
+ rc = SetMenuItemInfoA( hmenu, 0, TRUE, NULL );
+ ret = GetLastError();
+ ok (!rc, "SetMenuItemInfoA succeeded unexpectedly\n");
+ ok (ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
+
+ SetLastError(0xdeadbeef);
+ rc = SetMenuItemInfoA( hmenu, 0, FALSE, NULL );
+ ret = GetLastError();
+ ok (!rc, "SetMenuItemInfoA succeeded unexpectedly\n");
+ ok (ret == ERROR_INVALID_PARAMETER, "Expected 87, got %d\n", ret);
+
/* Just change ftype to string and see what text is stored */
memset(&info, 0x00, sizeof(info));
- info.cbSize= sizeof(MENUITEMINFO);
+ info.cbSize= sizeof(MENUITEMINFOA);
info.fMask= MIIM_FTYPE; /* Set string type */
info.fType= MFT_STRING;
- info.dwTypeData= (char *)0xdeadbeef;
- rc = SetMenuItemInfo( hmenu, 0, TRUE, &info );
+ info.dwTypeData= (char *)0xdeadbeef;
+ rc = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
ok (rc, "SetMenuItemInfo failed\n");
/* Did we keep the old dwTypeData? */
- ok (GetMenuString( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
+ ok (GetMenuStringA( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
ok (!strcmp( strback, "Dummy string" ), "Menu text from Ansi version incorrect\n");
/* Ensure change to bitmap type fails */
memset(&info, 0x00, sizeof(info));
- info.cbSize= sizeof(MENUITEMINFO);
+ info.cbSize= sizeof(MENUITEMINFOA);
info.fMask= MIIM_FTYPE; /* Set as bitmap type */
info.fType= MFT_BITMAP;
info.dwTypeData= (char *)0xdeadbee2;
- rc = SetMenuItemInfo( hmenu, 0, TRUE, &info );
+ rc = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
ok (!rc, "SetMenuItemInfo unexpectedly worked\n");
/* Just change ftype back and ensure data hasn't been freed */
info.fType= MFT_OWNERDRAW; /* Set as ownerdraw type */
info.dwTypeData= (char *)0xdeadbee3;
- rc = SetMenuItemInfo( hmenu, 0, TRUE, &info );
+ rc = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
ok (rc, "SetMenuItemInfo failed\n");
-
+
/* Did we keep the old dwTypeData? */
- ok (GetMenuString( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
+ ok (GetMenuStringA( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
ok (!strcmp( strback, "Dummy string" ), "Menu text from Ansi version incorrect\n");
/* Just change string value (not type) */
memset(&info, 0x00, sizeof(info));
- info.cbSize= sizeof(MENUITEMINFO);
+ info.cbSize= sizeof(MENUITEMINFOA);
info.fMask= MIIM_STRING; /* Set typeData */
strcpy(string2, "string2");
- info.dwTypeData= string2;
- rc = SetMenuItemInfo( hmenu, 0, TRUE, &info );
+ info.dwTypeData= string2;
+ rc = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
ok (rc, "SetMenuItemInfo failed\n");
- ok (GetMenuString( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
+ ok (GetMenuStringA( hmenu, 0, strback, 99, MF_BYPOSITION), "GetMenuString on ownerdraw entry failed\n");
ok (!strcmp( strback, "string2" ), "Menu text from Ansi version incorrect\n");
/* crashes with wine 0.9.5 */
memset(&info, 0x00, sizeof(info));
- info.cbSize= sizeof(MENUITEMINFO);
+ info.cbSize= sizeof(MENUITEMINFOA);
info.fMask= MIIM_FTYPE | MIIM_STRING; /* Set OwnerDraw + typeData */
info.fType= MFT_OWNERDRAW;
- rc = InsertMenuItem( hmenu, 0, TRUE, &info );
+ rc = InsertMenuItemA( hmenu, 0, TRUE, &info );
ok (rc, "InsertMenuItem failed\n");
- ok (!GetMenuString( hmenu, 0, NULL, 0, MF_BYPOSITION),
+ ok (!GetMenuStringA( hmenu, 0, NULL, 0, MF_BYPOSITION),
"GetMenuString on ownerdraw entry succeeded.\n");
SetLastError(0xdeadbeef);
ret = GetMenuStringW( hmenu, 0, NULL, 0, MF_BYPOSITION);
static void test_menu_iteminfo( void )
{
- int ansi = TRUE;
+ BOOL ansi = TRUE;
char txtA[]="wine";
char initA[]="XYZ";
char emptyA[]="";
static void test_menu_search_bycommand( void )
{
HMENU hmenu, hmenuSub, hmenuSub2;
- MENUITEMINFO info;
+ MENUITEMINFOA info;
BOOL rc;
UINT id;
char strback[0x80];
/* Case 1: Menu containing a menu item */
hmenu = CreateMenu();
-
+
memset( &info, 0, sizeof info );
info.cbSize = sizeof info;
info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
strcpy(strIn, "Case 1 MenuItem");
info.dwTypeData = strIn;
info.wID = (UINT) 0x1234;
-
- rc = InsertMenuItem(hmenu, 0, TRUE, &info );
+
+ rc = InsertMenuItemA(hmenu, 0, TRUE, &info );
ok (rc, "Inserting the menuitem failed\n");
id = GetMenuItemID(hmenu, 0);
/* Confirm the menuitem was given the id supplied (getting by position) */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, 0, TRUE, &info); /* Get by position */
+ rc = GetMenuItemInfoA(hmenu, 0, TRUE, &info); /* Get by position */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == 0x1234, "IDs differ for the menuitem\n");
ok (!strcmp(info.dwTypeData, "Case 1 MenuItem"), "Returned item has wrong label\n");
/* Search by id - Should return the item */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, 0x1234, FALSE, &info); /* Get by ID */
+ rc = GetMenuItemInfoA(hmenu, 0x1234, FALSE, &info); /* Get by ID */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == 0x1234, "IDs differ for the menuitem\n");
/* Case 2: Menu containing a popup menu */
hmenu = CreateMenu();
hmenuSub = CreateMenu();
-
+
strcpy(strIn, "Case 2 SubMenu");
- rc = InsertMenu(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, strIn);
+ rc = InsertMenuA(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, strIn);
ok (rc, "Inserting the popup menu into the main menu failed\n");
id = GetMenuItemID(hmenu, 0);
/* Confirm the menuitem itself was given an id the same as the HMENU, (getting by position) */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
info.wID = 0xdeadbeef;
- rc = GetMenuItemInfo(hmenu, 0, TRUE, &info); /* Get by position */
+ rc = GetMenuItemInfoA(hmenu, 0, TRUE, &info); /* Get by position */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for the menuitem\n");
ok (!strcmp(info.dwTypeData, "Case 2 SubMenu"), "Returned item has wrong label\n");
/* Search by id - returns the popup menu itself */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for the popup menu\n");
strcpy(strIn, "Case 2 MenuItem 1");
info.dwTypeData = strIn;
info.wID = (UINT_PTR) hmenuSub;
- rc = InsertMenuItem(hmenu, -1, TRUE, &info );
+ rc = InsertMenuItemA(hmenu, -1, TRUE, &info );
ok (rc, "Inserting the menuitem failed\n");
/* Search by id - returns the item which follows the popup menu */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for the popup menu\n");
strcpy(strIn, "Case 2 MenuItem 2");
info.dwTypeData = strIn;
info.wID = (UINT_PTR) hmenuSub;
- rc = InsertMenuItem(hmenu, 0, TRUE, &info );
+ rc = InsertMenuItemA(hmenu, 0, TRUE, &info );
ok (rc, "Inserting the menuitem failed\n");
/* Search by id - returns the item which precedes the popup menu */
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub, FALSE, &info); /* Get by ID */
ok (rc, "Getting the menu items info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for the popup menu\n");
info.dwTypeData = menuitem;
info.wID = (UINT_PTR) hmenuSub; /* Enforce id collisions with the hmenu of the popup submenu*/
- rc = InsertMenu(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
+ rc = InsertMenuA(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
ok (rc, "Inserting the popup menu into the main menu failed\n");
- rc = InsertMenuItem(hmenuSub, 0, TRUE, &info );
+ rc = InsertMenuItemA(hmenuSub, 0, TRUE, &info );
ok (rc, "Inserting the sub menu menuitem failed\n");
memset( &info, 0, sizeof info );
info.dwTypeData = menuitem2;
info.wID = (UINT_PTR) hmenuSub; /* Enforce id collisions with the hmenu of the popup submenu*/
- rc = InsertMenuItem(hmenuSub, 1, TRUE, &info );
+ rc = InsertMenuItemA(hmenuSub, 1, TRUE, &info );
ok (rc, "Inserting the sub menu menuitem 2 failed\n");
/* Prove that you can't query the id of a popup directly (By position) */
id = GetMenuItemID(hmenu, 0);
- ok (id == -1, "Getting the sub menu id should have failed because its a popup (gave %x)\n", id);
+ ok (id == -1, "Getting the sub menu id should have failed because it's a popup (gave %x)\n", id);
/* Prove getting the item info via ID returns the first item (not the popup or 2nd item)*/
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_STRING | MIIM_ID;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub, FALSE, &info);
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub, FALSE, &info);
ok (rc, "Getting the menus info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for popup menu\n");
ok (!strcmp(info.dwTypeData, "MenuItem"), "Returned item has wrong label (%s)\n", info.dwTypeData);
DestroyMenu( hmenu );
DestroyMenu( hmenuSub );
- /*
+ /*
Case 4: Menu containing 2 popup menus, the second
contains 2 items with the same id as the first popup menu
*/
hmenu = CreateMenu();
hmenuSub = CreateMenu();
hmenuSub2 = CreateMenu();
-
- rc = InsertMenu(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
+
+ rc = InsertMenuA(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
ok (rc, "Inserting the popup menu into the main menu failed\n");
-
- rc = InsertMenu(hmenu, 1, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub2, "Submenu2");
+
+ rc = InsertMenuA(hmenu, 1, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub2, "Submenu2");
ok (rc, "Inserting the popup menu into the main menu failed\n");
memset( &info, 0, sizeof info );
info.dwTypeData = menuitem;
info.wID = (UINT_PTR) hmenuSub; /* Enforce id collisions with the hmenu of the popup submenu*/
- rc = InsertMenuItem(hmenuSub2, 0, TRUE, &info );
+ rc = InsertMenuItemA(hmenuSub2, 0, TRUE, &info );
ok (rc, "Inserting the sub menu menuitem failed\n");
memset( &info, 0, sizeof info );
info.dwTypeData = menuitem2;
info.wID = (UINT_PTR) hmenuSub; /* Enforce id collisions with the hmenu of the popup submenu*/
- rc = InsertMenuItem(hmenuSub2, 1, TRUE, &info );
+ rc = InsertMenuItemA(hmenuSub2, 1, TRUE, &info );
ok (rc, "Inserting the sub menu menuitem 2 failed\n");
/* Prove getting the item info via ID returns the first item (not the popup or 2nd item)*/
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_STRING | MIIM_ID;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub, FALSE, &info);
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub, FALSE, &info);
ok (rc, "Getting the menus info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub, "IDs differ for popup menu\n");
ok (!strcmp(info.dwTypeData, "MenuItem"), "Returned item has wrong label (%s)\n", info.dwTypeData);
memset( &info, 0, sizeof info );
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_STRING | MIIM_ID;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, (UINT_PTR)hmenuSub2, FALSE, &info);
+ rc = GetMenuItemInfoA(hmenu, (UINT_PTR)hmenuSub2, FALSE, &info);
ok (rc, "Getting the menus info failed\n");
ok (info.wID == (UINT_PTR)hmenuSub2, "IDs differ for popup menu\n");
ok (!strcmp(info.dwTypeData, "Submenu2"), "Returned item has wrong label (%s)\n", info.dwTypeData);
DestroyMenu( hmenuSub2 );
- /*
+ /*
Case 5: Menu containing a popup menu which in turn
contains an item with a different id than the popup menu.
This tests the fallback to a popup menu ID.
hmenu = CreateMenu();
hmenuSub = CreateMenu();
- rc = AppendMenu(hmenu, MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
+ rc = AppendMenuA(hmenu, MF_POPUP | MF_STRING, (UINT_PTR)hmenuSub, "Submenu");
ok (rc, "Appending the popup menu to the main menu failed\n");
- rc = AppendMenu(hmenuSub, MF_STRING, 102, "Item");
+ rc = AppendMenuA(hmenuSub, MF_STRING, 102, "Item");
ok (rc, "Appending the item to the popup menu failed\n");
/* Set the ID for hmenuSub */
info.fMask = MIIM_ID;
info.wID = 101;
- rc = SetMenuItemInfo(hmenu, 0, TRUE, &info);
+ rc = SetMenuItemInfoA(hmenu, 0, TRUE, &info);
ok(rc, "Setting the ID for the popup menu failed\n");
/* Check if the ID has been set */
info.wID = 0;
- rc = GetMenuItemInfo(hmenu, 0, TRUE, &info);
+ rc = GetMenuItemInfoA(hmenu, 0, TRUE, &info);
ok(rc, "Getting the ID for the popup menu failed\n");
ok(info.wID == 101, "The ID for the popup menu has not been set\n");
/* Prove getting the item info via ID returns the popup menu */
memset( &info, 0, sizeof(info));
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_STRING | MIIM_ID;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, 101, FALSE, &info);
+ rc = GetMenuItemInfoA(hmenu, 101, FALSE, &info);
ok (rc, "Getting the menu info failed\n");
ok (info.wID == 101, "IDs differ\n");
ok (!strcmp(info.dwTypeData, "Submenu"), "Returned item has wrong label (%s)\n", info.dwTypeData);
/* Also look for the menu item */
memset( &info, 0, sizeof(info));
strback[0] = 0x00;
- info.cbSize = sizeof(MENUITEMINFO);
+ info.cbSize = sizeof(MENUITEMINFOA);
info.fMask = MIIM_STRING | MIIM_ID;
info.dwTypeData = strback;
info.cch = sizeof(strback);
- rc = GetMenuItemInfo(hmenu, 102, FALSE, &info);
+ rc = GetMenuItemInfoA(hmenu, 102, FALSE, &info);
ok (rc, "Getting the menu info failed\n");
ok (info.wID == 102, "IDs differ\n");
ok (!strcmp(info.dwTypeData, "Item"), "Returned item has wrong label (%s)\n", info.dwTypeData);
ret = pSendInput(3, (INPUT *) i, sizeof(INPUT));
/* hack to prevent mouse message buildup in Wine */
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
return ret;
}
/* mixed keyboard/mouse test */
for (i = 0; menu_tests[i].type != -1; i++)
{
- int ret = TRUE, elapsed = 0;
+ BOOL ret = TRUE;
+ int elapsed = 0;
got_input = i && menu_tests[i-1].bMenuVisible;
if (!ret)
{
skip( "test %u: failed to send input\n", i );
- PostMessage( hWnd, WM_CANCELMODE, 0, 0 );
+ PostMessageA( hWnd, WM_CANCELMODE, 0, 0 );
return 0;
}
while (menu_tests[i].bMenuVisible != bMenuVisible)
if (!got_input)
{
skip( "test %u: didn't receive input\n", i );
- PostMessage( hWnd, WM_CANCELMODE, 0, 0 );
+ PostMessageA( hWnd, WM_CANCELMODE, 0, 0 );
return 0;
}
default:
return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
}
-#if 0
+
if(pGetMenuBarInfo)
{
MENUBARINFO mbi;
ok(!(bMenuVisible && (state & MF_HILITE)) == !mbi.fFocused,
"msg %x: GetMenuBarInfo.fFocused (%d) is wrong\n", msg, mbi.fFocused != 0);
}
-#endif
+
if (msg == WM_EXITMENULOOP)
bMenuVisible = FALSE;
else if (msg == WM_INITMENUPOPUP)
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
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;
if (!hWnd) return;
/* fixed menus */
hMenus[3] = CreatePopupMenu();
- AppendMenu(hMenus[3], MF_STRING, 0, "&Enabled");
- AppendMenu(hMenus[3], MF_STRING|MF_DISABLED, 0, "&Disabled");
+ AppendMenuA(hMenus[3], MF_STRING, 0, "&Enabled");
+ AppendMenuA(hMenus[3], MF_STRING|MF_DISABLED, 0, "&Disabled");
hMenus[2] = CreatePopupMenu();
- AppendMenu(hMenus[2], MF_STRING|MF_POPUP, (UINT_PTR) hMenus[3], "&Popup");
- AppendMenu(hMenus[2], MF_STRING, 0, "&Enabled");
- AppendMenu(hMenus[2], MF_STRING|MF_DISABLED, 0, "&Disabled");
+ AppendMenuA(hMenus[2], MF_STRING|MF_POPUP, (UINT_PTR) hMenus[3], "&Popup");
+ AppendMenuA(hMenus[2], MF_STRING, 0, "&Enabled");
+ AppendMenuA(hMenus[2], MF_STRING|MF_DISABLED, 0, "&Disabled");
hMenus[1] = CreateMenu();
- AppendMenu(hMenus[1], MF_STRING|MF_POPUP, (UINT_PTR) hMenus[2], "&Menu");
- AppendMenu(hMenus[1], MF_STRING, 0, "&Enabled");
- AppendMenu(hMenus[1], MF_STRING|MF_DISABLED, 0, "&Disabled");
+ AppendMenuA(hMenus[1], MF_STRING|MF_POPUP, (UINT_PTR) hMenus[2], "&Menu");
+ AppendMenuA(hMenus[1], MF_STRING, 0, "&Enabled");
+ AppendMenuA(hMenus[1], MF_STRING|MF_DISABLED, 0, "&Disabled");
SetMenu(hWnd, hMenus[1]);
ShowWindow(hWnd, SW_SHOW);
{
if (WAIT_TIMEOUT != WaitForSingleObject(hThread, 50))
break;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
}
DestroyWindow(hWnd);
}
hMenu = CreateMenu();
hPopupMenu = CreatePopupMenu();
- AppendMenu(hMenu, MF_POPUP | MF_STRING, (UINT_PTR)hPopupMenu, "Popup");
+ AppendMenuA(hMenu, MF_POPUP | MF_STRING, (UINT_PTR)hPopupMenu, "Popup");
- AppendMenu(hPopupMenu, MF_STRING | MF_HILITE | MF_DEFAULT, 101, "Item 1");
- InsertMenu(hPopupMenu, 1, MF_BYPOSITION | MF_STRING | MF_HILITE | MF_DEFAULT, 102, "Item 2");
- AppendMenu(hPopupMenu, MF_STRING, 103, "Item 3");
- ModifyMenu(hPopupMenu, 2, MF_BYPOSITION | MF_STRING | MF_HILITE | MF_DEFAULT, 103, "Item 3");
+ AppendMenuA(hPopupMenu, MF_STRING | MF_HILITE | MF_DEFAULT, 101, "Item 1");
+ InsertMenuA(hPopupMenu, 1, MF_BYPOSITION | MF_STRING | MF_HILITE | MF_DEFAULT, 102, "Item 2");
+ AppendMenuA(hPopupMenu, MF_STRING, 103, "Item 3");
+ ModifyMenuA(hPopupMenu, 2, MF_BYPOSITION | MF_STRING | MF_HILITE | MF_DEFAULT, 103, "Item 3");
ok(GetMenuState(hPopupMenu, 0, MF_BYPOSITION) & MF_HILITE,
"AppendMenu should accept MF_HILITE\n");
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = WndProc;
wclass.hInstance = GetModuleHandleA( NULL );
- 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;
hMenu = CreateMenu();
hPopupMenu = CreatePopupMenu();
- AppendMenu(hMenu, MF_POPUP | MF_STRING, (UINT_PTR)hPopupMenu, "Popup");
+ AppendMenuA(hMenu, MF_POPUP | MF_STRING, (UINT_PTR)hPopupMenu, "Popup");
- AppendMenu(hPopupMenu, MF_STRING, 101, "Item 1");
- AppendMenu(hPopupMenu, MF_STRING, 102, "Item 2");
- AppendMenu(hPopupMenu, MF_STRING, 103, "Item 3");
+ AppendMenuA(hPopupMenu, MF_STRING, 101, "Item 1");
+ AppendMenuA(hPopupMenu, MF_STRING, 102, "Item 2");
+ AppendMenuA(hPopupMenu, MF_STRING, 103, "Item 3");
SetMenu(hWnd, hMenu);
for (i = 0; i < count; i++)
{
BOOL ret;
- MENUITEMINFO mii;
+ MENUITEMINFOA mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU;
- ret = GetMenuItemInfo(hmenu, i, TRUE, &mii);
+ ret = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
ok(ret, "GetMenuItemInfo(%u) failed\n", i);
-#if 0
+if (0)
trace("item #%u: fType %04x, fState %04x, wID %u, hSubMenu %p\n",
i, mii.fType, mii.fState, mii.wID, mii.hSubMenu);
-#endif
+
if (mii.hSubMenu)
{
ok(mii.wID == (UINT_PTR)mii.hSubMenu, "id %u: wID should be equal to hSubMenu\n", checked_cmd);
static void clear_ftype_and_state(HMENU hmenu, UINT id, UINT flags)
{
BOOL ret;
- MENUITEMINFO mii;
+ MENUITEMINFOA mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_STATE;
- ret = SetMenuItemInfo(hmenu, id, (flags & MF_BYPOSITION) != 0, &mii);
+ ret = SetMenuItemInfoA(hmenu, id, (flags & MF_BYPOSITION) != 0, &mii);
ok(ret, "SetMenuItemInfo(%u) failed\n", id);
}
BOOL ret;
HMENU hmenu;
- hmenu = LoadMenu(GetModuleHandle(0), MAKEINTRESOURCE(1));
+ hmenu = LoadMenuA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(1));
assert(hmenu != 0);
check_menu_items(hmenu, -1, 0, 0);
INT count, i;
BOOL ret;
- hmenu = LoadMenuIndirect(&menu_template);
+ hmenu = LoadMenuIndirectA(&menu_template);
ok(hmenu != 0, "LoadMenuIndirect error %u\n", GetLastError());
- ret = AppendMenu(hmenu, MF_STRING, 6, NULL);
+ ret = AppendMenuA(hmenu, MF_STRING, 6, NULL);
ok(ret, "AppendMenu failed\n");
- ret = AppendMenu(hmenu, MF_STRING, 7, "\0");
+ ret = AppendMenuA(hmenu, MF_STRING, 7, "\0");
ok(ret, "AppendMenu failed\n");
- ret = AppendMenu(hmenu, MF_SEPARATOR, 8, "separator");
+ ret = AppendMenuA(hmenu, MF_SEPARATOR, 8, "separator");
ok(ret, "AppendMenu failed\n");
count = GetMenuItemCount(hmenu);
for (i = 0; i < count; i++)
{
char buf[20];
- MENUITEMINFO mii;
+ MENUITEMINFOA mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.dwTypeData = buf;
mii.cch = sizeof(buf);
mii.fMask = MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_STRING;
- ret = GetMenuItemInfo(hmenu, i, TRUE, &mii);
+ ret = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
ok(ret, "GetMenuItemInfo(%u) failed\n", i);
-#if 0
+if (0)
trace("item #%u: fType %04x, fState %04x, wID %u, dwTypeData %s\n",
i, mii.fType, mii.fState, mii.wID, (LPCSTR)mii.dwTypeData);
-#endif
+
ok(mii.fType == menu_data[i].type,
"%u: expected fType %04x, got %04x\n", i, menu_data[i].type, mii.fType);
ok(mii.fState == menu_data[i].state,
for (i = 0; i < item_count; i++)
{
SetLastError(0xdeadbeef);
- ret = AppendMenu(hmenu, item[i].type, item[i].id, item[i].str);
+ ret = AppendMenuA(hmenu, item[i].type, item[i].id, item[i].str);
ok(ret, "%d: AppendMenu(%04x, %04x, %p) error %u\n",
i, item[i].type, item[i].id, item[i].str, GetLastError());
}
HMENU hmenu;
INT i;
BOOL ret;
- MENUITEMINFO mii = { sizeof( MENUITEMINFO)};
+ MENUITEMINFOA mii = { sizeof( MENUITEMINFOA) };
hmenu = CreateMenu();
assert(hmenu != 0);
mii.fState = 0;
if( item[i].type & MF_HELP) mii.fType |= MF_HELP;
mii.wID = item[i].id;
- ret = InsertMenuItem( hmenu, -1, TRUE, &mii);
+ ret = InsertMenuItemA( hmenu, -1, TRUE, &mii);
ok(ret, "%d: InsertMenuItem(%04x, %04x, %p) error %u\n",
i, item[i].type, item[i].id, item[i].str, GetLastError());
}
for (i = 0; i < count; i++)
{
char buf[20];
- MENUITEMINFO mii;
+ MENUITEMINFOA mii;
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.dwTypeData = buf;
mii.cch = sizeof(buf);
mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_BITMAP;
- ret = GetMenuItemInfo(hmenu, i, TRUE, &mii);
+ ret = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
ok(ret, "GetMenuItemInfo(%u) failed\n", i);
-#if 0
+if (0)
trace("item #%u: fType %04x, fState %04x, wID %04x, hbmp %p\n",
i, mii.fType, mii.fState, mii.wID, mii.hbmpItem);
-#endif
+
ok(mii.fType == item[i].type,
"%u: expected fType %04x, got %04x\n", i, item[i].type, mii.fType);
ok(mii.wID == item[i].id,
static const struct menu_data in1[] =
{
{ MF_STRING, 1, "File" },
- { MF_BITMAP|MF_HELP, SC_CLOSE, MAKEINTRESOURCE(1) },
+ { MF_BITMAP|MF_HELP, SC_CLOSE, MAKEINTRESOURCEA(1) },
{ MF_STRING|MF_HELP, 2, "Help" }
};
static const struct menu_data out1[] =
{
{ MF_STRING, 1, "File" },
{ MF_STRING|MF_HELP, 2, "Help" },
- { MF_BITMAP|MF_HELP, SC_CLOSE, MAKEINTRESOURCE(1) }
+ { MF_BITMAP|MF_HELP, SC_CLOSE, MAKEINTRESOURCEA(1) }
};
static const struct menu_data out1a[] =
{
{ MF_STRING, 1, "File" },
{ MF_STRING|MF_HELP, 2, "Help" },
- { MF_HELP, SC_CLOSE, MAKEINTRESOURCE(1) }
+ { MF_HELP, SC_CLOSE, MAKEINTRESOURCEA(1) }
};
const struct menu_data in2[] =
{
static const struct menu_data in3[] =
{
{ MF_STRING, 1, "File" },
- { MF_SEPARATOR|MF_HELP, SC_CLOSE, MAKEINTRESOURCE(1) },
+ { MF_SEPARATOR|MF_HELP, SC_CLOSE, MAKEINTRESOURCEA(1) },
{ MF_STRING|MF_HELP, 2, "Help" }
};
static const struct menu_data out3[] =
{
{ MF_STRING, 1, "File" },
- { MF_SEPARATOR|MF_HELP, SC_CLOSE, MAKEINTRESOURCE(0) },
+ { MF_SEPARATOR|MF_HELP, SC_CLOSE, MAKEINTRESOURCEA(0) },
{ MF_STRING|MF_HELP, 2, "Help" },
};
static const struct menu_data in4[] =
{
{ MF_STRING, 1, "File" },
- { MF_BITMAP|MF_HELP, 1, MAKEINTRESOURCE(1) },
+ { MF_BITMAP|MF_HELP, 1, MAKEINTRESOURCEA(1) },
{ MF_STRING|MF_HELP, 2, "Help" }
};
static const struct menu_data out4[] =
{
{ MF_STRING, 1, "File" },
{ MF_STRING|MF_HELP, 2, "Help" },
- { MF_BITMAP|MF_HELP, 1, MAKEINTRESOURCE(1) }
+ { MF_BITMAP|MF_HELP, 1, MAKEINTRESOURCEA(1) }
};
static const struct menu_data out4a[] =
{
{ MF_STRING, 1, "File" },
{ MF_STRING|MF_HELP, 2, "Help" },
- { MF_HELP, 1, MAKEINTRESOURCE(1) }
+ { MF_HELP, 1, MAKEINTRESOURCEA(1) }
};
HMENU hmenu;
{
HMENU hmenu, hsubmenu;
MENUINFO mi = {0};
- MENUITEMINFOA mii = {sizeof( MENUITEMINFOA)};
+ MENUITEMINFOA mii = { sizeof(MENUITEMINFOA) };
BOOL ret;
DWORD gle;
assert( hmenu && hsubmenu);
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = hsubmenu;
- ret = InsertMenuItem( hmenu, 0, FALSE, &mii);
+ ret = InsertMenuItemA( hmenu, 0, FALSE, &mii);
ok( ret, "InsertMenuItem failed with error %d\n", GetLastError());
/* test some parameter errors */
SetLastError(0xdeadbeef);
HMENU hmenu;
DWORD gle;
int Ex;
- HWND hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
if (!hwnd) return;
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
for( Ex = 0; Ex < 2; Ex++)
{
hmenu = CreatePopupMenu();
/* exit menu modal loop
* ( A SendMessage does not work on NT3.51 here ) */
- return PostMessage(hwnd, WM_CANCELMODE, 0, 0);
+ return PostMessageA(hwnd, WM_CANCELMODE, 0, 0);
}
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void test_menu_trackagain(void)
HWND hwnd;
BOOL ret;
- hwnd = CreateWindowEx(0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
if (!hwnd) return;
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_track_again_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_track_again_wnd_proc);
g_hmenu = CreatePopupMenu();
ok(g_hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+ ret = AppendMenuA(g_hmenu, MF_STRING , 100, "item 1");
+ ok(ret, "AppendMenu failed.\n");
+ ret = AppendMenuA(g_hmenu, MF_STRING , 101, "item 2");
+ ok(ret, "AppendMenu failed.\n");
+
ret = TrackPopupMenu( g_hmenu, 0, 100, 100, 0, hwnd, NULL);
- todo_wine ok(ret == FALSE, "got %d\n", ret);
+ ok(ret == TRUE, "got %d\n", ret);
DestroyMenu(g_hmenu);
DestroyWindow(hwnd);
{
case WM_ENTERMENULOOP:
g_got_enteridle = 0;
- return SendMessage( g_hwndtosend, WM_CANCELMODE, 0, 0);
+ return SendMessageA( g_hwndtosend, WM_CANCELMODE, 0, 0);
case WM_ENTERIDLE:
{
if( g_got_enteridle++ == 0) {
/* little hack to get another WM_ENTERIDLE message */
- PostMessage( hwnd, WM_MOUSEMOVE, 0, 0);
- return SendMessage( g_hwndtosend, WM_CANCELMODE, 0, 0);
+ PostMessageA( hwnd, WM_MOUSEMOVE, 0, 0);
+ return SendMessageA( g_hwndtosend, WM_CANCELMODE, 0, 0);
}
pEndMenu();
return TRUE;
}
}
- return DefWindowProc( hwnd, msg, wparam, lparam);
+ return DefWindowProcA( hwnd, msg, wparam, lparam);
}
static void test_menu_cancelmode(void)
win_skip( "EndMenu is not available\n");
return;
}
- hwnd = CreateWindowEx( 0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ hwnd = CreateWindowExA( 0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
NULL, NULL, NULL, NULL);
- hwndchild = CreateWindowEx( 0, MAKEINTATOM(atomMenuCheckClass), NULL,
+ hwndchild = CreateWindowExA( 0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
WS_VISIBLE | WS_CHILD, 10, 10, 20, 20,
hwnd, NULL, NULL, NULL);
ok( hwnd != NULL && hwndchild != NULL,
"CreateWindowEx failed with error %d\n", GetLastError());
g_hwndtosend = hwnd;
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
- SetWindowLongPtr( hwndchild, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
+ SetWindowLongPtrA( hwndchild, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
menu = CreatePopupMenu();
ok( menu != NULL, "CreatePopupMenu failed with error %d\n", GetLastError());
ret = AppendMenuA( menu, MF_STRING, 1, "winetest");
ok( ret, "Functie failed lasterror is %u\n", GetLastError());
/* seems to be needed only on wine :( */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
/* test the effect of sending a WM_CANCELMODE message in the WM_INITMENULOOP
* handler of the menu owner */
/* test results is extracted from variable g_got_enteridle. Possible values:
/* menu owner is top level window */
g_hwndtosend = hwnd;
TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
- todo_wine {
- ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
- }
- ok( g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+ ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
/* menu owner is child window */
g_hwndtosend = hwndchild;
TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL);
- todo_wine {
- ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
- }
- ok(g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+ ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
/* now send the WM_CANCELMODE messages to the WRONG window */
/* those should fail ( to have any effect) */
g_hwndtosend = hwnd;
ok( ret, "SetMenu failed lasterror is %u\n", GetLastError());
/* initiate tracking */
g_hwndtosend = hwnd;
- ret = SendMessage( hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0 );
+ ret = SendMessageA( hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0 );
ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %u\n", GetLastError());
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
- todo_wine {
- ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
- }
- ok(g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
+ ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
/* cleanup */
DestroyMenu( menubar );
BYTE bmfill[300];
HMENU menu;
HBITMAP hbm1, hbm2, hbm3;
- MENUITEMINFO mii = { sizeof(MENUITEMINFO)};
+ MENUITEMINFOA mii = { sizeof(MENUITEMINFOA) };
DWORD ret;
HWND hwnd;
MENUINFO mi = { sizeof( MENUINFO)};
skip( "interactive alignment tests.\n");
return;
}
- hwnd = CreateWindowEx(0,
+ hwnd = CreateWindowExA(0,
"STATIC",
"Menu text alignment Test\nPlease make a selection.",
WS_OVERLAPPEDWINDOW,
mii.wID = 1;
mii.hbmpItem = hbm1;
mii.dwTypeData = (LPSTR) " OK: menu texts are correctly left-aligned.";
- ret = InsertMenuItem( menu, -1, TRUE, &mii);
+ ret = InsertMenuItemA( menu, -1, TRUE, &mii);
ok( ret, "InsertMenuItem() failed\n");
mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_ID ;
mii.wID = 2;
mii.hbmpItem = hbm2;
mii.dwTypeData = (LPSTR) " FAIL: menu texts are NOT left-aligned.";
- ret = InsertMenuItem( menu, -1, TRUE, &mii);
+ ret = InsertMenuItemA( menu, -1, TRUE, &mii);
ok( ret, "InsertMenuItem() failed\n");
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
ok( ret != 2, "User indicated that menu text alignment test 1 failed %d\n", ret);
mii.wID = 3;
mii.hbmpItem = hbm3;
mii.dwTypeData = NULL;
- ret = InsertMenuItem( menu, 0, TRUE, &mii);
+ ret = InsertMenuItemA( menu, 0, TRUE, &mii);
ok( ret, "InsertMenuItem() failed\n");
mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_ID;
mii.wID = 1;
/* make the text a bit longer, to keep it readable */
/* this bug is on winXP and reproduced on wine */
mii.dwTypeData = (LPSTR) " OK: menu texts are to the right of the bitmaps........";
- ret = SetMenuItemInfo( menu, 1, TRUE, &mii);
+ ret = SetMenuItemInfoA( menu, 1, TRUE, &mii);
ok( ret, "SetMenuItemInfo() failed\n");
mii.wID = 2;
mii.hbmpItem = hbm2;
mii.dwTypeData = (LPSTR) " FAIL: menu texts are below the first bitmap. ";
- ret = SetMenuItemInfo( menu, 2, TRUE, &mii);
+ ret = SetMenuItemInfoA( menu, 2, TRUE, &mii);
ok( ret, "SetMenuItemInfo() failed\n");
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
ok( ret != 2, "User indicated that menu text alignment test 2 failed %d\n", ret);
mii.wID = 3;
mii.fType = MFT_BITMAP;
mii.dwTypeData = (LPSTR) hbm3;
- ret = SetMenuItemInfo( menu, 0, TRUE, &mii);
+ ret = SetMenuItemInfoA( menu, 0, TRUE, &mii);
ok( ret, "SetMenuItemInfo() failed\n");
mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_ID;
mii.wID = 1;
mii.hbmpItem = NULL;
mii.dwTypeData = (LPSTR) " OK: menu texts are below the bitmap.";
- ret = SetMenuItemInfo( menu, 1, TRUE, &mii);
+ ret = SetMenuItemInfoA( menu, 1, TRUE, &mii);
ok( ret, "SetMenuItemInfo() failed\n");
mii.wID = 2;
mii.hbmpItem = NULL;
mii.dwTypeData = (LPSTR) " FAIL: menu texts are NOT below the bitmap.";
- ret = SetMenuItemInfo( menu, 2, TRUE, &mii);
+ ret = SetMenuItemInfoA( menu, 2, TRUE, &mii);
ok( ret, "SetMenuItemInfo() failed\n");
ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
ok( ret != 2, "User indicated that menu text alignment test 3 failed %d\n", ret);
DestroyWindow( hwnd);
}
+static LRESULT WINAPI menu_fill_in_init(HWND hwnd, UINT msg,
+ WPARAM wparam, LPARAM lparam)
+{
+ HMENU hmenupopup;
+ BOOL ret;
+ switch (msg)
+ {
+ case WM_INITMENUPOPUP:
+ gflag_initmenupopup++;
+ hmenupopup = (HMENU) wparam;
+ ret = AppendMenuA(hmenupopup, MF_STRING , 100, "item 1");
+ ok(ret, "AppendMenu failed.\n");
+ ret = AppendMenuA(hmenupopup, MF_STRING , 101, "item 2");
+ ok(ret, "AppendMenu failed.\n");
+ break;
+ case WM_ENTERMENULOOP:
+ gflag_entermenuloop++;
+ break;
+ case WM_INITMENU:
+ gflag_initmenu++;
+ break;
+ case WM_ENTERIDLE:
+ gflag_enteridle++;
+ PostMessageA(hwnd, WM_CANCELMODE, 0, 0);
+ return TRUE;
+ case WM_MENUSELECT:
+ selectitem_wp = wparam;
+ selectitem_lp = lparam;
+ break;
+ }
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
+}
+
+static void test_emptypopup(void)
+{
+ BOOL ret;
+ HMENU hmenu;
+
+ HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
+ WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
+ NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
+
+ hmenu = CreatePopupMenu();
+ ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+
+ gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
+ selectitem_wp = 0xdeadbeef;
+ selectitem_lp = 0xdeadbeef;
+
+ ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
+ ok(ret == 0, "got %i\n", ret);
+
+ ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup);
+ ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop);
+ ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
+ todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
+
+ todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
+ todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
+
+ gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
+ selectitem_wp = 0xdeadbeef;
+ selectitem_lp = 0xdeadbeef;
+
+ ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL);
+ todo_wine ok(ret == 0, "got %i\n", ret);
+
+ ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup);
+ ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop);
+ ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
+ todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
+
+ todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
+ todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
+
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_fill_in_init);
+
+ gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
+ selectitem_wp = 0xdeadbeef;
+ selectitem_lp = 0xdeadbeef;
+
+ ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL);
+ ok(ret == 1, "got %i\n", ret);
+
+ ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup);
+ ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop);
+ ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
+ ok(gflag_enteridle == 1, "got %i\n", gflag_initmenu);
+
+ ok(selectitem_wp == 0xffff0000, "got %lx\n", selectitem_wp);
+ ok(selectitem_lp == 0, "got %lx\n", selectitem_lp);
+
+ DestroyWindow(hwnd);
+
+ ret = DestroyMenu(hmenu);
+ ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+}
+
START_TEST(menu)
{
init_function_pointers();
test_menu_cancelmode();
test_menu_maxdepth();
test_menu_circref();
+ test_emptypopup();
}
static BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
+static HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT,DWORD);
static HMONITOR (WINAPI *pMonitorFromWindow)(HWND,DWORD);
static void init_function_pointers(void)
GET_PROC(EnumDisplayMonitors)
GET_PROC(GetMonitorInfoA)
GET_PROC(MonitorFromPoint)
+ GET_PROC(MonitorFromRect)
GET_PROC(MonitorFromWindow)
#undef GET_PROC
}
SetLastError(0xdeadbeef);
- res = EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
+ res = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
ok(res, "EnumDisplaySettings error %u\n", GetLastError());
width = dm.dmPelsWidth;
static void test_monitors(void)
{
- HMONITOR monitor, primary;
+ HMONITOR monitor, primary, nearest;
POINT pt;
+ RECT rc;
- if (!pMonitorFromPoint || !pMonitorFromWindow)
+ if (!pMonitorFromPoint || !pMonitorFromWindow || !pMonitorFromRect)
{
- win_skip("MonitorFromPoint or MonitorFromWindow are not available\n");
+ win_skip("MonitorFromPoint, MonitorFromWindow, or MonitorFromRect is not available\n");
return;
}
ok( monitor == primary, "got %p, should get primary %p for MONITOR_DEFAULTTOPRIMARY\n", monitor, primary );
monitor = pMonitorFromWindow( 0, MONITOR_DEFAULTTONEAREST );
ok( monitor == primary, "got %p, should get primary %p for MONITOR_DEFAULTTONEAREST\n", monitor, primary );
+
+ SetRect( &rc, 0, 0, 1, 1 );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTOPRIMARY );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONEAREST );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ /* Empty rect at 0,0 is considered inside the primary monitor */
+ SetRect( &rc, 0, 0, -1, -1 );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ /* Even if there is a monitor left of the primary, the primary will have the most overlapping area */
+ SetRect( &rc, -1, 0, 2, 1 );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ /* But the width of the rect doesn't matter if it's empty. */
+ SetRect( &rc, -1, 0, 2, -1 );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ ok( monitor != primary, "got primary %p\n", monitor );
+
+ if (!pGetMonitorInfoA)
+ {
+ win_skip("GetMonitorInfoA is not available\n");
+ return;
+ }
+
+ /* Search for a monitor that has no others equally near to (left, top-1) */
+ SetRect( &rc, -1, -2, 2, 0 );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ nearest = primary;
+ while (monitor != NULL)
+ {
+ MONITORINFO mi;
+ BOOL ret;
+ ok( monitor != primary, "got primary %p\n", monitor );
+ nearest = monitor;
+ mi.cbSize = sizeof(mi);
+ ret = pGetMonitorInfoA( monitor, &mi );
+ ok( ret, "GetMonitorInfo failed\n" );
+ SetRect( &rc, mi.rcMonitor.left-1, mi.rcMonitor.top-2, mi.rcMonitor.left+2, mi.rcMonitor.top );
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ }
+
+ SetRect( &rc, rc.left+1, rc.top+1, rc.left+2, rc.top+2 );
+
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL );
+ ok( monitor == NULL, "got %p\n", monitor );
+
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTOPRIMARY );
+ ok( monitor == primary, "got %p, should get primary %p\n", monitor, primary );
+
+ monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONEAREST );
+ ok( monitor == nearest, "got %p, should get nearest %p\n", monitor, nearest );
}
static BOOL CALLBACK find_primary_mon(HMONITOR hmon, HDC hdc, LPRECT rc, LPARAM lp)
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
SetLastError(0xdeadbeef);
- ret = SystemParametersInfo(SPI_GETWORKAREA, 0, &rc_work, 0);
+ ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0);
ok(ret, "SystemParametersInfo error %u\n", GetLastError());
trace("work area (%d,%d-%d,%d)\n", rc_work.left, rc_work.top, rc_work.right, rc_work.bottom);
ok(EqualRect(&rc_work, &mi.rcWork), "work area is different\n");
- hwnd = CreateWindowEx(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL);
+ hwnd = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL);
ok(hwnd != 0, "CreateWindowEx failed\n");
ret = GetWindowRect(hwnd, &rc_normal);
else
ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n");
- SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+ SetWindowLongA(hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
wp.length = sizeof(wp);
ret = GetWindowPlacement(hwnd, &wp);
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ERASEBKGND, sent|optional },
- { HCBT_ACTIVATE, hook },
+ { HCBT_ACTIVATE, hook|optional },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
{ WM_NCPAINT, sent|wparam|optional, 1 },
- { WM_ACTIVATEAPP, sent|wparam, 1 },
- { WM_NCACTIVATE, sent|wparam, 1 },
+ { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
+ { WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
- { WM_ACTIVATE, sent|wparam, 1 },
- { HCBT_SETFOCUS, hook },
+ { WM_ACTIVATE, sent|wparam|optional, 1 },
+ { HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
- { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
+ { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_GETMINMAXINFO, sent|defwinproc },
{ WM_NCCALCSIZE, sent|wparam, TRUE },
{ EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
- { HCBT_ACTIVATE, hook },
+ { HCBT_ACTIVATE, hook|optional },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
- { WM_ACTIVATEAPP, sent|wparam, 1 },
- { WM_NCACTIVATE, sent|wparam, 1 },
+ { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
+ { WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
- { WM_ACTIVATE, sent|wparam, 1 },
- { HCBT_SETFOCUS, hook },
+ { WM_ACTIVATE, sent|wparam|optional, 1 },
+ { HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
- { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
+ { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
{ WM_QUERYOPEN, sent|optional },
{ WM_GETTEXT, sent|optional },
- { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
- { WM_GETMINMAXINFO, sent|defwinproc },
- { WM_NCCALCSIZE, sent|wparam, TRUE },
- { HCBT_ACTIVATE, hook },
+ { WM_NCACTIVATE, sent|wparam|optional, 1 },
+ { WM_WINDOWPOSCHANGING, sent|optional }, /* SWP_NOSIZE|SWP_NOMOVE */
+ { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
+ { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
+ { WM_MOVE, sent|optional },
+ { WM_SIZE, sent|wparam|optional, SIZE_RESTORED },
+ { WM_GETTEXT, sent|optional },
+ { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
+ { WM_GETMINMAXINFO, sent|defwinproc|optional },
+ { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
+ { HCBT_ACTIVATE, hook|optional },
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
- { WM_ACTIVATEAPP, sent|wparam, 1 },
- { WM_NCACTIVATE, sent|wparam, 1 },
+ { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
+ { WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
- { WM_ACTIVATE, sent|wparam, 1 },
- { HCBT_SETFOCUS, hook },
+ { WM_ACTIVATE, sent|wparam|optional, 1 },
+ { HCBT_SETFOCUS, hook|optional },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
- { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
+ { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 },
{ WM_GETTEXT, sent|optional },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_STATECHANGED|SWP_FRAMECHANGED|SWP_NOCOPYBITS },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
+ { HCBT_SETFOCUS, hook|optional },
+ { WM_SETFOCUS, sent|wparam|optional, 0 },
{ WM_NCCALCSIZE, sent|wparam|optional, TRUE },
{ WM_NCPAINT, sent|wparam|optional, 1 },
{ WM_ERASEBKGND, sent|optional },
+ { HCBT_SETFOCUS, hook|optional },
+ { WM_SETFOCUS, sent|wparam|optional, 0 },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_GETTEXT, sent|optional },
{ WM_PAINT, sent|optional },
/* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
static const struct message WmShowMinOverlappedSeq[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
- { HCBT_SETFOCUS, hook },
+ { HCBT_SETFOCUS, hook|optional },
{ EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
- { WM_KILLFOCUS, sent },
+ { WM_KILLFOCUS, sent|optional },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
{ WM_GETTEXT, sent|optional },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
- { WM_NCACTIVATE, sent|wparam, 0 },
+ { WM_NCACTIVATE, sent|wparam|optional, 0 },
{ WM_GETTEXT, sent|defwinproc|optional },
- { WM_ACTIVATE, sent },
- { WM_ACTIVATEAPP, sent|wparam, 0 },
+ { WM_ACTIVATE, sent|optional },
+ { WM_ACTIVATEAPP, sent|wparam|optional, 0 },
/* Vista sometimes restores the window right away... */
{ WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
{ WM_ACTIVATE, sent|wparam|optional, 0 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 0 },
{ HCBT_SETFOCUS, hook|optional },
- { WM_KILLFOCUS, sent|wparam, 0 },
+ { WM_KILLFOCUS, sent|wparam|optional, 0 },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
{ 0 }
{ 0 }
};
+static const struct message WmTrackPopupMenu[] = {
+ { HCBT_CREATEWND, hook },
+ { WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
+ { WM_INITMENU, sent|lparam, 0, 0 },
+ { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
+ { 0x0093, sent|optional },
+ { 0x0094, sent|optional },
+ { 0x0094, sent|optional },
+ { WM_ENTERIDLE, sent|wparam, 2 },
+ { WM_CAPTURECHANGED, sent },
+ { HCBT_DESTROYWND, hook },
+ { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
+ { WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 },
+ { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
+ { 0 }
+};
+
+static const struct message WmTrackPopupMenuEmpty[] = {
+ { HCBT_CREATEWND, hook },
+ { WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
+ { WM_INITMENU, sent|lparam, 0, 0 },
+ { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
+ { 0x0093, sent|optional },
+ { 0x0094, sent|optional },
+ { 0x0094, sent|optional },
+ { WM_CAPTURECHANGED, sent },
+ { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
+ { HCBT_DESTROYWND, hook },
+ { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
+ { 0 }
+};
+
static BOOL after_end_dialog, test_def_id, paint_loop_done;
static int sequence_cnt, sequence_size;
static struct recvd_message* sequence;
HMENU hmenu;
MSG msg;
LRESULT res;
+ POINT pos;
flush_sequence();
after_end_dialog = FALSE;
test_def_id = FALSE;
- hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP,
+ ok(GetCursorPos(&pos), "GetCursorPos failed\n");
+ ok(SetCursorPos(109, 109), "SetCursorPos failed\n");
+
+ hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP|WS_CHILD,
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL);
ok(hwnd != 0, "Failed to create custom dialog window\n");
flush_sequence();
trace("call ShowWindow(%p, SW_SHOW)\n", hwnd);
ShowWindow(hwnd, SW_SHOW);
ok_sequence(WmShowCustomDialogSeq, "ShowCustomDialog", TRUE);
+
+ flush_events();
+ flush_sequence();
+ ok(DrawMenuBar(hwnd), "DrawMenuBar failed: %d\n", GetLastError());
+ flush_events();
+ ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE);
+ ok(SetCursorPos(pos.x, pos.y), "SetCursorPos failed\n");
DestroyWindow(hwnd);
flush_sequence();
flush_sequence();
/* Message sequence for SetMenu */
- ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a window without a menu\n");
+ ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a destroyed window\n");
+ ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "last error is %d\n", GetLastError());
ok_sequence(WmEmptySeq, "DrawMenuBar for a window without a menu", FALSE);
hmenu = CreateMenu();
};
static const struct message WmShowNoActivate_2[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_SHOWNOACTIVATE },
- { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
- { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
+ { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
+ { HCBT_ACTIVATE, hook|optional },
+ { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
+ { HCBT_SETFOCUS, hook|optional },
+ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|defwinproc, SIZE_RESTORED },
{ HCBT_SETFOCUS, hook|optional },
static const struct message WmMinimize_2[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
{ HCBT_SETFOCUS, hook|optional },
- { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
- { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
+ { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
+ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 },
{ 0 }
};
static const struct message WmMinimize_3[] = {
{ HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
- { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
- { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
+ { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
+ { HCBT_ACTIVATE, hook|optional },
+ { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
+ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 },
{ 0 }
win_rc.left, win_rc.top, win_rc.right, win_rc.bottom,
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom);
-
- flush_events();
- flush_sequence();
}
-
DestroyWindow(hwnd);
+ flush_events();
}
static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 );
- ok( GetMessageW( &msg, hwnd, 0, 0 ), "no message\n" );
+ while (GetMessageW( &msg, hwnd, 0, 0 ))
+ {
+ if (!ignore_message( msg.message )) break;
+ }
+
ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
ok( msg.wParam == 0x3b1, "bad wparam %lx\n", msg.wParam );
DeleteObject( bmp );
}
+static HMENU hpopupmenu;
+
+static LRESULT WINAPI cancel_popup_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (ignore_message( message )) return 0;
+
+ switch (message) {
+ case WM_ENTERIDLE:
+ todo_wine ok(GetCapture() == hwnd, "expected %p, got %p\n", hwnd, GetCapture());
+ EndMenu();
+ break;
+ case WM_INITMENU:
+ case WM_INITMENUPOPUP:
+ case WM_UNINITMENUPOPUP:
+ ok((HMENU)wParam == hpopupmenu, "expected %p, got %lx\n", hpopupmenu, wParam);
+ break;
+ }
+
+ return MsgCheckProc (FALSE, hwnd, message, wParam, lParam);
+}
+
+static void test_TrackPopupMenu(void)
+{
+ HWND hwnd;
+ BOOL ret;
+
+ hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
+ 0, 0, 1, 1, 0,
+ NULL, NULL, 0);
+ ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
+
+ hpopupmenu = CreatePopupMenu();
+ ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+
+ AppendMenuA(hpopupmenu, MF_STRING, 100, "item 1");
+ AppendMenuA(hpopupmenu, MF_STRING, 100, "item 2");
+
+ flush_events();
+ flush_sequence();
+ ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
+ ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE);
+ ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
+
+ DestroyMenu(hpopupmenu);
+ DestroyWindow(hwnd);
+}
+
+static void test_TrackPopupMenuEmpty(void)
+{
+ HWND hwnd;
+ BOOL ret;
+
+ hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
+ 0, 0, 1, 1, 0,
+ NULL, NULL, 0);
+ ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
+
+ hpopupmenu = CreatePopupMenu();
+ ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+
+ flush_events();
+ flush_sequence();
+ ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
+ ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE);
+ todo_wine ok(ret == 0, "TrackPopupMenu succeeded\n");
+
+ DestroyMenu(hpopupmenu);
+ DestroyWindow(hwnd);
+}
+
static void init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
pUnhookWinEvent = 0;
}
hEvent_hook = 0;
-
test_SetFocus();
test_SetParent();
test_PostMessage();
test_combobox_messages();
test_wmime_keydown_message();
test_paint_messages();
- if(!winetest_interactive)
- skip("ReactOS ActivateActCtx seems to be broken.\n");
- else
test_interthread_messages();
test_message_conversion();
test_accelerators();
test_keyflags();
test_hotkey();
test_layered_window();
+ test_TrackPopupMenu();
+ test_TrackPopupMenuEmpty();
/* keep it the last test, under Windows it tends to break the tests
* which rely on active/foreground windows being correct.
*/
#include "wine/test.h"
-static UINT (WINAPI *pPrivateExtractIconsA)(LPCTSTR, int, int, int, HICON *, UINT *, UINT, UINT) = NULL;
+static UINT (WINAPI *pPrivateExtractIconsA)(LPCSTR, int, int, int, HICON *, UINT *, UINT, UINT) = NULL;
static void init_function_pointers(void)
{
static void test_LoadStringW(void)
{
- HINSTANCE hInst = GetModuleHandle(NULL);
+ HINSTANCE hInst = GetModuleHandleA(NULL);
WCHAR copiedstringw[128], returnedstringw[128], *resourcepointer = NULL;
char copiedstring[128], returnedstring[128];
int length1, length2, retvalue;
static void test_LoadStringA (void)
{
- HINSTANCE hInst = GetModuleHandle (NULL);
+ HINSTANCE hInst = GetModuleHandleA(NULL);
static const char str[] = "String resource"; /* same in resource.rc */
char buf[128];
struct string_test {
ac[n].key = 0;
ac[n++].fVirt = 0;
- hAccel = CreateAcceleratorTable( &ac[0], n );
+ hAccel = CreateAcceleratorTableA( &ac[0], n );
ok( hAccel != NULL, "create accelerator table\n");
r = DestroyAcceleratorTable( hAccel );
ac[n].key = 0xffff;
ac[n++].fVirt = 0x0001;
- hAccel = CreateAcceleratorTable( &ac[0], n );
+ hAccel = CreateAcceleratorTableA( &ac[0], n );
ok( hAccel != NULL, "create accelerator table\n");
- r = CopyAcceleratorTable( hAccel, NULL, 0 );
+ r = CopyAcceleratorTableA( hAccel, NULL, 0 );
ok( r == n, "two entries in table %u/%u\n", r, n);
- r = CopyAcceleratorTable( hAccel, &ac[0], n );
+ r = CopyAcceleratorTableA( hAccel, &ac[0], n );
ok( r == n, "still should be two entries in table %u/%u\n", r, n);
n=0;
r = DestroyAcceleratorTable( hAccel );
ok( r, "destroy accelerator table\n");
- hAccel = CreateAcceleratorTable( &ac[0], 0 );
+ hAccel = CreateAcceleratorTableA( &ac[0], 0 );
ok( !hAccel || broken(hAccel != NULL), /* nt4 */ "zero elements should fail\n");
/* these will on crash win2k
*/
/* try a zero count */
- hac = CreateAcceleratorTable( &ac[0], 0 );
+ hac = CreateAcceleratorTableA( &ac[0], 0 );
ok( !hac || broken(hac != NULL), /* nt4 */ "fail\n");
if (!hac) ok( !DestroyAcceleratorTable( hac ), "destroy failed\n");
/* creating one accelerator should work */
- hac = CreateAcceleratorTable( &ac[0], 1 );
+ hac = CreateAcceleratorTableA( &ac[0], 1 );
ok( hac != NULL , "fail\n");
- ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy failed\n");
+ ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* how about two of the same type? */
- hac = CreateAcceleratorTable( &ac[0], 2);
+ hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
- res = CopyAcceleratorTable( hac, NULL, 100 );
+ res = CopyAcceleratorTableA( hac, NULL, 100 );
ok( res == 2, "copy null failed %d\n", res);
- res = CopyAcceleratorTable( hac, NULL, 0 );
+ res = CopyAcceleratorTableA( hac, NULL, 0 );
ok( res == 2, "copy null failed %d\n", res);
- res = CopyAcceleratorTable( hac, NULL, 1 );
+ res = CopyAcceleratorTableA( hac, NULL, 1 );
ok( res == 2, "copy null failed %d\n", res);
- ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy 1 failed\n");
- ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
+ ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
+ ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
/* how about two of the same type with a non-zero key? */
ac[0].key = 0x20;
ac[1].key = 0x20;
- hac = CreateAcceleratorTable( &ac[0], 2);
+ hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
- ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
+ ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
ac[0].key = 0x40;
ac[1].fVirt = FVIRTKEY;
ac[1].key = 0x40;
- hac = CreateAcceleratorTable( &ac[0], 2);
+ hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
- ok( 2 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
+ ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
/* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
/* how virtual key codes */
ac[0].fVirt = FVIRTKEY;
- hac = CreateAcceleratorTable( &ac[0], 1);
+ hac = CreateAcceleratorTableA( &ac[0], 1);
ok( hac != NULL , "fail\n");
- ok( 1 == CopyAcceleratorTable( hac, out, 2 ), "copy 2 failed\n");
+ ok( 1 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
/* ok( !memcmp( ac, out, sizeof ac/2 ), "tables different\n"); */
ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
ac[0].cmd = 0xffff;
ac[0].fVirt = 0xff;
ac[0].key = 0xffff;
- hac = CreateAcceleratorTable( &ac[0], 1);
+ hac = CreateAcceleratorTableA( &ac[0], 1);
ok( hac != NULL , "fail\n");
- ok( 1 == CopyAcceleratorTable( hac, out, 1 ), "copy 1 failed\n");
+ ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
/* ok( memcmp( ac, out, sizeof ac/2 ), "tables not different\n"); */
ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
ok( out[0].fVirt == (ac[0].fVirt&0x7f), "fVirt not modified\n");
/* how turning on all bits? */
memset( ac, 0xff, sizeof ac );
- hac = CreateAcceleratorTable( &ac[0], 2);
+ hac = CreateAcceleratorTableA( &ac[0], 2);
ok( hac != NULL , "fail\n");
- res = CopyAcceleratorTable( hac, out, 2 );
+ res = CopyAcceleratorTableA( hac, out, 2 );
ok( res == 2, "copy 2 failed %d\n", res);
/* ok( memcmp( ac, out, sizeof ac ), "tables not different\n"); */
ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
}
static void test_PrivateExtractIcons(void) {
- CONST CHAR szShell32Dll[] = "shell32.dll";
+ const CHAR szShell32Dll[] = "shell32.dll";
HICON ahIcon[256];
- UINT aIconId[256];
- UINT cIcons, cIcons2;
+ UINT i, aIconId[256], cIcons, cIcons2;
if (!pPrivateExtractIconsA) return;
-
+
+ cIcons = pPrivateExtractIconsA("", 0, 16, 16, ahIcon, aIconId, 1, 0);
+ ok(cIcons == ~0u, "got %u\n", cIcons);
+
+ cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0);
+ ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
+
+ ahIcon[0] = (HICON)0xdeadbeef;
+ cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0);
+ ok(cIcons == 1, "got %u\n", cIcons);
+ ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
+ DestroyIcon(ahIcon[0]);
+
+ ahIcon[0] = (HICON)0xdeadbeef;
+ aIconId[0] = 0xdeadbeef;
+ cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, aIconId, 1, 0);
+ ok(cIcons == 1, "got %u\n", cIcons);
+ ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
+ ok(aIconId[0] != 0xdeadbeef, "id not set\n");
+ DestroyIcon(ahIcon[0]);
+
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, NULL, NULL, 0, 0);
cIcons2 = pPrivateExtractIconsA(szShell32Dll, 4, MAKELONG(32,16), MAKELONG(32,16),
NULL, NULL, 256, 0);
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0);
ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons);
+ for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
/* count must be a multiple of two when getting two sizes */
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
ahIcon, aIconId, 3, 0);
ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons);
+ for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
+
cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
ahIcon, aIconId, 4, 0);
ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons);
+ for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
}
static void test_LoadImage(void)
HBITMAP bmp;
HRSRC hres;
- bmp = LoadBitmapA(GetModuleHandle(NULL), MAKEINTRESOURCE(100));
+ bmp = LoadBitmapA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(100));
ok(bmp != NULL, "Could not load a bitmap resource\n");
if (bmp) DeleteObject(bmp);
- hres = FindResource(GetModuleHandle(NULL), "#100", RT_BITMAP);
+ hres = FindResourceA(GetModuleHandleA(NULL), "#100", (LPCSTR)RT_BITMAP);
ok(hres != NULL, "Could not find a bitmap resource with a numeric string\n");
- bmp = LoadBitmapA(GetModuleHandle(NULL), "#100");
+ bmp = LoadBitmapA(GetModuleHandleA(NULL), "#100");
ok(bmp != NULL, "Could not load a bitmap resource with a numeric string\n");
if (bmp) DeleteObject(bmp);
}
{
/* test that scrollbar tracking is terminated when
* the control looses mouse capture */
- SendMessage( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
+ SendMessageA( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
/* a normal return from the sendmessage */
/* not normal for instance by closing the windws */
ok( IsWindow( hScroll), "Scrollbar has gone!\n");
wc.cbSize = sizeof wc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = GetModuleHandleA(0);
- wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
+ wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = cls_name;
wc.lpfnWndProc = scroll_init_proc;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = NULL;
- wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
+ wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_IBEAM);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyTestWnd";
while (diff > 0)
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
diff = time - GetTickCount();
}
}
static HWND build_static(DWORD style)
{
- return CreateWindow("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
+ return CreateWindowA("static", "Test", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)CTRL_ID, NULL, 0);
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
break;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void test_updates(int style, int flags)
START_TEST(static)
{
- static char szClassName[] = "testclass";
- WNDCLASSEX wndclass;
+ static const char szClassName[] = "testclass";
+ WNDCLASSEXA wndclass;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = GetModuleHandle(NULL);
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hInstance = GetModuleHandleA(NULL);
+ wndclass.hIcon = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
+ wndclass.hIconSm = LoadIconA(NULL, (LPCSTR)IDI_APPLICATION);
+ wndclass.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = szClassName;
wndclass.lpszMenuName = NULL;
- RegisterClassEx(&wndclass);
+ RegisterClassExA(&wndclass);
- hMainWnd = CreateWindow(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandle(NULL), NULL);
+ hMainWnd = CreateWindowA(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandleA(NULL), NULL);
ShowWindow(hMainWnd, SW_SHOW);
test_updates(0, 0);
if (!EnumDisplaySettingsA(NULL, num, &devmode)) {
DWORD le = GetLastError();
ok(le == ERROR_NO_MORE_FILES ||
+ le == ERROR_MOD_NOT_FOUND /* Win8 */ ||
le == 0xdeadbeef, /* XP, 2003 */
- "Expected ERROR_NO_MORE_FILES or 0xdeadbeef, got %d for %d\n", le, num);
+ "Expected ERROR_NO_MORE_FILES, ERROR_MOD_NOT_FOUND or 0xdeadbeef, got %d for %d\n", le, num);
break;
}
num++;
ReleaseDC(0, hdc);
}
+static void test_SubtractRect(void)
+{
+ RECT rect1;
+ RECT rect2;
+ RECT rectr;
+ BOOL result;
+
+ /* source rectangles don't intersect */
+ SetRect(&rect1, 50, 50, 150, 100);
+ SetRect(&rect2, 250, 200, 1500, 1000);
+ result = SubtractRect(&rectr, &rect1, &rect2);
+ ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
+ ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150
+ && rectr.bottom == 100, "wrong rect subtraction of SubtractRect "
+ "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
+ /* source rect 2 partially overlaps rect 1 */
+ SetRect(&rect1, 2431, 626, 3427, 1608);
+ SetRect(&rect2, 2499, 626, 3427, 1608);
+ result = SubtractRect(&rectr, &rect1, &rect2);
+ ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
+ ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
+ && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
+ "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
+ /* source rect 2 partially overlaps rect 1 - dest is src rect 2 */
+ SetRect(&rect1, 2431, 626, 3427, 1608);
+ SetRect(&rect2, 2499, 626, 3427, 1608);
+ result = SubtractRect(&rect2, &rect1, &rect2);
+ ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
+ ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
+ && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect "
+ "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
+ /* source rect 2 completely overlaps rect 1 */
+ SetRect(&rect1, 250, 250, 400, 500);
+ SetRect(&rect2, 50, 50, 1500, 1000);
+ result = SubtractRect(&rectr, &rect1, &rect2);
+ ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
+ "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom);
+
+ /* source rect 2 completely overlaps rect 1 - dest is src rect 2 */
+ SetRect(&rect1, 250, 250, 400, 500);
+ SetRect(&rect2, 50, 50, 1500, 1000);
+ result = SubtractRect(&rect2, &rect1, &rect2);
+ ok(!result, "SubtractRect returned TRUE but subtraction should be empty "
+ "(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom);
+}
+
START_TEST(uitools)
{
test_FillRect();
+ test_SubtractRect();
}
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
if (remove_messages)
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
diff = time - GetTickCount();
min_timeout = 50;
}
"wrong error %u\n", GetLastError() );
}
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
count = 0;
ret = EnumThreadWindows( GetCurrentThreadId(), enum_proc, (LPARAM)&count );
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MainWindowClass";
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "ToolWindowClass";
/* win2k and XP return broken border info in GetWindowInfo most of
* the time, so there is no point in testing it.
*/
-#if 0
+if (0)
+{
UINT border;
ok(info->cxWindowBorders == (unsigned)(rcClient.left - rcWindow.left),
"wrong cxWindowBorders %d != %d\n", info->cxWindowBorders, rcClient.left - rcWindow.left);
border = min(rcWindow.bottom - rcClient.bottom, rcClient.top - rcWindow.top);
ok(info->cyWindowBorders == border,
"wrong cyWindowBorders %d != %d\n", info->cyWindowBorders, border);
-#endif
+}
ok(info->atomWindowType == GetClassLongA(hwnd, GCW_ATOM), "wrong atomWindowType for %p in hook %s\n",
hwnd, hook);
ok(info->wCreatorVersion == 0x0400 /* NT4, Win2000, XP, Win2003 */ ||
}
shellWindow = GetShellWindow();
- hinst = GetModuleHandle(0);
+ hinst = GetModuleHandleA(NULL);
hUser32 = GetModuleHandleA("user32");
SetShellWindow = (void *)GetProcAddress(hUser32, "SetShellWindow");
CloseHandle(hProcess);
}
- hwnd1 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST1"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 100, 100, 300, 200, 0, 0, hinst, 0);
+ hwnd1 = CreateWindowExA(0, "#32770", "TEST1", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 100, 100, 300, 200, 0, 0, hinst, 0);
trace("created window 1: %p\n", hwnd1);
ret = SetShellWindow(hwnd1);
/* passes on Win XP, but not on Win98
ok(!ret, "third call to SetShellWindow(hwnd1)\n"); */
- SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
- ret = (GetWindowLong(hwnd1,GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+ SetWindowLongA(hwnd1, GWL_EXSTYLE, GetWindowLongA(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
+ ret = (GetWindowLongA(hwnd1,GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n");
ret = DestroyWindow(hwnd1);
ok(ret, "DestroyWindow(hwnd1)\n");
- hwnd2 = CreateWindowEx(WS_EX_TOPMOST, TEXT("#32770"), TEXT("TEST2"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 150, 250, 300, 200, 0, 0, hinst, 0);
+ hwnd2 = CreateWindowExA(WS_EX_TOPMOST, "#32770", "TEST2", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 150, 250, 300, 200, 0, 0, hinst, 0);
trace("created window 2: %p\n", hwnd2);
ret = SetShellWindow(hwnd2);
ok(!ret, "SetShellWindow(hwnd2) with WS_EX_TOPMOST\n");
- hwnd3 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST3"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 200, 400, 300, 200, 0, 0, hinst, 0);
+ hwnd3 = CreateWindowExA(0, "#32770", "TEST3", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 200, 400, 300, 200, 0, 0, hinst, 0);
trace("created window 3: %p\n", hwnd3);
- hwnd4 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST4"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 250, 500, 300, 200, 0, 0, hinst, 0);
+ hwnd4 = CreateWindowExA(0, "#32770", "TEST4", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 250, 500, 300, 200, 0, 0, hinst, 0);
trace("created window 4: %p\n", hwnd4);
nextWnd = GetWindow(hwnd4, GW_HWNDNEXT);
shellWindow = GetShellWindow();
ok(shellWindow==hwnd4, "wrong shell window: %p - expected hwnd4\n", shellWindow);
- hwnd5 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST5"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 300, 600, 300, 200, 0, 0, hinst, 0);
+ hwnd5 = CreateWindowExA(0, "#32770", "TEST5", WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 300, 600, 300, 200, 0, 0, hinst, 0);
trace("created window 5: %p\n", hwnd5);
ret = SetWindowPos(hwnd4, hwnd5, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "SetWindowPos(hwnd4, hwnd5)\n");
mdi_cs.szClass = "MDI_child_Class_1";
mdi_cs.szTitle = "MDI child";
- mdi_cs.hOwner = GetModuleHandle(0);
+ mdi_cs.hOwner = GetModuleHandleA(NULL);
mdi_cs.x = CW_USEDEFAULT;
mdi_cs.y = CW_USEDEFAULT;
mdi_cs.cx = CW_USEDEFAULT;
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, GetModuleHandle(0),
+ mdi_client, GetModuleHandleA(NULL),
(LPARAM)mdi_lParam_test_message);
if (!mdi_child)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
if (!mdi_child)
{
WS_CHILD,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- parent, 0, GetModuleHandle(0),
+ parent, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(!mdi_child, "WS_EX_MDICHILD with a not MDIClient parent should fail\n");
}
WS_CHILD, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_POPUP, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE | WS_CAPTION,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
WS_CHILD | WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- mdi_client, 0, GetModuleHandle(0),
+ mdi_client, 0, GetModuleHandleA(NULL),
mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
id = GetWindowLongPtrA(mdi_child, GWLP_ID);
child_4, child_3, child_2, child_1);
trace("Activate child next to %p\n", child_3);
- SendMessage(mdi_client, WM_MDINEXT, (WPARAM)child_3, 0);
+ 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);
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);
- SendMessage(mdi_client, WM_MDINEXT, (WPARAM)child_1, 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);
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);
NULL,
WS_CHILD,
0, 0, rc.right, rc.bottom,
- hwnd, 0, GetModuleHandle(0),
+ hwnd, 0, GetModuleHandleA(NULL),
&client_cs);
assert(mdi_client);
test_MDI_child_stack(mdi_client);
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MDI_parent_Class";
WS_MAXIMIZEBOX /*| WS_VISIBLE*/,
100, 100, CW_USEDEFAULT, CW_USEDEFAULT,
GetDesktopWindow(), 0,
- GetModuleHandle(0), NULL);
+ GetModuleHandleA(NULL), NULL);
assert(mdi_hwndMain);
/*
while(GetMessage(&msg, 0, 0, 0))
{
WNDCLASSEXA cls;
HWND hwnd;
- HICON icon = LoadIconA(0, IDI_APPLICATION);
- HICON icon2 = LoadIconA(0, IDI_QUESTION);
- HICON small_icon = LoadImageA(0, IDI_APPLICATION, IMAGE_ICON,
+ HICON icon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ HICON icon2 = LoadIconA(0, (LPCSTR)IDI_QUESTION);
+ HICON small_icon = LoadImageA(0, (LPCSTR)IDI_APPLICATION, IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED );
HICON res;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
cls.hInstance = 0;
- cls.hIcon = LoadIconA(0, IDI_HAND);
+ cls.hIcon = LoadIconA(0, (LPCSTR)IDI_HAND);
cls.hIconSm = small_icon;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "IconWindowClass";
else InflateRect( rect, -10, -10 );
return 0;
}
- return DefWindowProc( hwnd, msg, wparam, lparam );
+ return DefWindowProcA( hwnd, msg, wparam, lparam );
}
static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
GetWindowRect(hwnd, &orig_win_rc);
- old_proc = SetWindowLongPtr( hwnd, GWLP_WNDPROC, (ULONG_PTR)nccalcsize_proc );
+ old_proc = SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (ULONG_PTR)nccalcsize_proc );
ret = SetWindowPos(hwnd, 0, 100, 100, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
ok(ret, "Got %d\n", ret);
GetWindowRect( hwnd, &rect );
ret = SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top,
orig_win_rc.right, orig_win_rc.bottom, 0);
ok(ret, "Got %d\n", ret);
- SetWindowLongPtr( hwnd, GWLP_WNDPROC, old_proc );
+ SetWindowLongPtrA( hwnd, GWLP_WNDPROC, old_proc );
/* Win9x truncates coordinates to 16-bit irrespectively */
if (!is_win9x)
orig_win_rc.right, orig_win_rc.bottom, 0);
ok(ret, "Got %d\n", ret);
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+ ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
ret = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
+ ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
ret = SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
+ ok(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "WS_EX_TOPMOST should be set\n");
ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
ok(ret, "Got %d\n", ret);
- ok(!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
+ ok(!(GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST), "WS_EX_TOPMOST should not be set\n");
hwnd_desktop = GetDesktopWindow();
ok(!!hwnd_desktop, "Failed to get hwnd_desktop window (%d).\n", GetLastError());
ret = GetMenu(child);
ok(ret == (HMENU)10, "unexpected menu id %p\n", ret);
- style = GetWindowLong(child, GWL_STYLE);
- SetWindowLong(child, GWL_STYLE, style | WS_POPUP);
+ style = GetWindowLongA(child, GWL_STYLE);
+ SetWindowLongA(child, GWL_STYLE, style | WS_POPUP);
ok(SetMenu(child, hMenu), "SetMenu on a popup child window should not fail\n");
ok(SetMenu(child, 0), "SetMenu on a popup child window should not fail\n");
- SetWindowLong(child, GWL_STYLE, style);
+ SetWindowLongA(child, GWL_STYLE, style);
- SetWindowLong(child, GWL_STYLE, style | WS_OVERLAPPED);
- ok(!SetMenu(child, hMenu), "SetMenu on a overlapped child window should fail\n");
- SetWindowLong(child, GWL_STYLE, style);
+ SetWindowLongA(child, GWL_STYLE, style | WS_OVERLAPPED);
+ ok(!SetMenu(child, hMenu), "SetMenu on an overlapped child window should fail\n");
+ SetWindowLongA(child, GWL_STYLE, style);
DestroyWindow(child);
DestroyMenu(hMenu);
{
if (style[i] & DS_CONTROL)
{
- child[i] = CreateWindowExA(0, MAKEINTATOM(32770), "", style[i] & ~WS_VISIBLE,
+ child[i] = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(32770), "", style[i] & ~WS_VISIBLE,
0,0,0,0, parent, (HMENU)i, 0, NULL);
if (style[i] & WS_VISIBLE)
ShowWindow(child[i], SW_SHOW);
/* skip foreign windows */
while (test && test != next &&
(GetWindowThreadProcessId(test, NULL) != our_pid ||
- UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)) != GetModuleHandle(0) ||
+ UlongToHandle(GetWindowLongPtrA(test, GWLP_HINSTANCE)) != GetModuleHandleA(NULL) ||
GetWindow(test, GW_OWNER) == next))
{
/*trace("skipping next %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
/* skip foreign windows */
while (test && test != prev &&
(GetWindowThreadProcessId(test, NULL) != our_pid ||
- UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)) != GetModuleHandle(0) ||
+ UlongToHandle(GetWindowLongPtrA(test, GWLP_HINSTANCE)) != GetModuleHandleA(NULL) ||
GetWindow(test, GW_OWNER) == hwnd))
{
/*trace("skipping prev %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
test = GetWindow(hwnd, GW_OWNER);
ok_(file, line)(owner == test, "%p: expected owner %p, got %p\n", hwnd, owner, test);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok_(file, line)(!(ex_style & WS_EX_TOPMOST) == !topmost, "%p: expected %stopmost\n",
hwnd, topmost ? "" : "NOT ");
}
check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE);
check_z_order(hwnd_E, 0, hwnd_D, 0, FALSE);
- hwnd_F = CreateWindowEx(0, "MainWindowClass", "Owner window",
+ hwnd_F = CreateWindowExA(0, "MainWindowClass", "Owner window",
WS_OVERLAPPED | WS_CAPTION,
100, 100, 100, 100,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_F %p\n", hwnd_F);
check_z_order(hwnd_F, hwnd_D, 0, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, 0, 0, FALSE);
- hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_F, 0, GetModuleHandle(0), NULL);
+ hwnd_F, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, hwnd_C, 0, FALSE);
check_z_order(hwnd_C, hwnd_D, 0, hwnd_F, FALSE);
- hwnd_B = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
+ hwnd_B = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_F, 0, GetModuleHandle(0), NULL);
+ hwnd_F, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_B %p\n", hwnd_B);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
check_z_order(hwnd_C, hwnd_D, hwnd_B, hwnd_F, FALSE);
check_z_order(hwnd_B, hwnd_C, 0, hwnd_F, TRUE);
- hwnd_A = CreateWindowEx(WS_EX_TOPMOST, "MainWindowClass", NULL,
+ hwnd_A = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_A %p\n", hwnd_A);
check_z_order(hwnd_F, 0, hwnd_E, 0, FALSE);
check_z_order(hwnd_E, hwnd_F, hwnd_D, 0, FALSE);
/* make hwnd_C owned by a topmost window */
DestroyWindow( hwnd_C );
- hwnd_C = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL,
style,
100, 100, 100, 100,
- hwnd_A, 0, GetModuleHandle(0), NULL);
+ hwnd_A, 0, GetModuleHandleA(NULL), NULL);
trace("hwnd_C %p\n", hwnd_C);
check_z_order(hwnd_E, 0, hwnd_D, 0, FALSE);
check_z_order(hwnd_D, hwnd_E, hwnd_F, 0, FALSE);
ok(GetFocus() == child, "Focus should be on child %p\n", child);
return 0;
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void test_SetFocus(HWND hwnd)
SetFocus(0);
SetFocus(hwnd);
ok( GetFocus() == hwnd, "Failed to set focus to visible window %p\n", hwnd );
- ok( GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE, "Window %p not visible\n", hwnd );
+ ok( GetWindowLongA(hwnd,GWL_STYLE) & WS_VISIBLE, "Window %p not visible\n", hwnd );
ShowWindow(hwnd, SW_HIDE);
SetFocus(0);
SetFocus(hwnd);
ok( GetFocus() == hwnd, "Failed to set focus to invisible window %p\n", hwnd );
- ok( !(GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE), "Window %p still visible\n", hwnd );
+ ok( !(GetWindowLongA(hwnd,GWL_STYLE) & WS_VISIBLE), "Window %p still visible\n", hwnd );
child = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, hwnd, 0, 0, NULL);
assert(child);
SetFocus(child);
ok( GetFocus() == child, "Failed to set focus to invisible child %p\n", child );
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ShowWindow(child, SW_SHOW);
- ok( GetWindowLong(child,GWL_STYLE) & WS_VISIBLE, "Child %p is not visible\n", child );
+ ok( GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE, "Child %p is not visible\n", child );
ok( GetFocus() == child, "Focus no longer on child %p\n", child );
ShowWindow(child, SW_HIDE);
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() );
ShowWindow(child, SW_SHOW);
child2 = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, child, 0, 0, NULL);
ShowWindow(child2, SW_SHOW);
SetFocus(child2);
ShowWindow(child, SW_HIDE);
- ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
+ ok( !(GetWindowLongA(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child );
ok( GetFocus() == child2, "Focus should be on %p, not %p\n", child2, GetFocus() );
ShowWindow(child, SW_SHOW);
SetFocus(child);
ok( GetFocus() != child, "Focus should not be on child %p\n", child );
todo_wine
ok( GetFocus() != hwnd, "Focus should not be on parent %p\n", hwnd );
- old_wnd_proc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)set_focus_on_activate_proc);
+ old_wnd_proc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)set_focus_on_activate_proc);
ShowWindow(hwnd, SW_RESTORE);
ok( GetActiveWindow() == hwnd, "parent window %p should be active\n", hwnd);
todo_wine
ok( GetFocus() == child, "Focus should be on child %p, not %p\n", child, GetFocus() );
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
+ SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)old_wnd_proc);
SetFocus( hwnd );
SetParent( child, GetDesktopWindow());
BOOL ret;
HWND hwnd2;
MSG msg;
+ LONG style;
flush_events( TRUE );
ShowWindow(hwnd, SW_HIDE);
hwnd2 = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, 0, 0, 0, 0);
check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
- thread_params.window_created = CreateEvent(NULL, FALSE, FALSE, NULL);
+ thread_params.window_created = CreateEventW(NULL, FALSE, FALSE, NULL);
ok(!!thread_params.window_created, "CreateEvent failed, last error %#x.\n", GetLastError());
- thread_params.test_finished = CreateEvent(NULL, FALSE, FALSE, NULL);
+ thread_params.test_finished = CreateEventW(NULL, FALSE, FALSE, NULL);
ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError());
thread = CreateThread(NULL, 0, create_window_thread, &thread_params, 0, &tid);
ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError());
SetForegroundWindow(hwnd2);
check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
+ SetForegroundWindow(hwnd);
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+ style = GetWindowLongA(hwnd2, GWL_STYLE) | WS_CHILD;
+ ok(SetWindowLongA(hwnd2, GWL_STYLE, style), "SetWindowLong failed\n");
+ ok(SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n");
+ check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
+
+ SetForegroundWindow(hwnd);
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+ ok(SetWindowLongA(hwnd2, GWL_STYLE, style & (~WS_POPUP)), "SetWindowLong failed\n");
+ ok(!SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n");
+ check_wnd_state(hwnd, hwnd, hwnd, 0);
+
SetEvent(thread_params.test_finished);
WaitForSingleObject(thread, INFINITE);
CloseHandle(thread_params.test_finished);
/* button wnd proc should release capture on WM_KILLFOCUS if it does
* match internal button state.
*/
- SendMessage(button, WM_KILLFOCUS, 0, 0);
+ SendMessageA(button, WM_KILLFOCUS, 0, 0);
check_wnd_state(button, button, button, 0);
ShowWindow(hwnd, SW_SHOW);
/* button wnd proc should ignore WM_KILLFOCUS if it doesn't match
* internal button state.
*/
- SendMessage(button, WM_KILLFOCUS, 0, 0);
+ SendMessageA(button, WM_KILLFOCUS, 0, 0);
check_wnd_state(button, button, button, button);
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
wclass.style = CS_HREDRAW | CS_VREDRAW;
wclass.lpfnWndProc = test_capture_4_proc;
wclass.hInstance = hInstance;
- wclass.hIcon = LoadIconA( 0, IDI_APPLICATION );
- wclass.hCursor = LoadCursorA( NULL, IDC_ARROW );
+ wclass.hIcon = LoadIconA( 0, (LPCSTR)IDI_APPLICATION );
+ wclass.hCursor = LoadCursorA( 0, (LPCSTR)IDC_ARROW );
wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 );
wclass.lpszMenuName = 0;
wclass.cbClsExtra = 0;
ret = peek_message(msg);
if (ret)
{
- if (msg->message == WM_PAINT) DispatchMessage(msg);
+ if (msg->message == WM_PAINT) DispatchMessageA(msg);
else break;
}
else if (MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
if (msg.message == WM_TIMER || ignore_message(msg.message)) continue;
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE,
"hwnd %p message %04x\n", msg.hwnd, msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ret = peek_message(&msg);
ok( !ret, "message %04x available\n", msg.message);
0, rc1.left, rc1.top, rc1.right, rc1.bottom);
/* same test, but with client edge: not enough width */
- SetWindowLong( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLong( hwnd, GWL_EXSTYLE));
+ SetWindowLongA( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLongA( hwnd, GWL_EXSTYLE));
nccalchelper( hwnd, sbwidth, 100, &rc1);
ok( rc1.right - rc1.left == sbwidth - 2 * GetSystemMetrics(SM_CXEDGE),
"Width should be %d size is %d,%d - %d,%d\n",
ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n");
ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n");
+ ok(SetParent(parent, desktop) != 0, "SetParent should not fail\n");
+ ok(SetParent(child4, child3) != 0, "SetParent should not fail\n");
+ ok(SetParent(child3, child2) != 0, "SetParent should not fail\n");
+ ok(SetParent(child2, child1) != 0, "SetParent should not fail\n");
+ ok(!IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
+ SetWindowLongW(child4, GWL_STYLE, WS_CHILD);
+ ok(IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4);
+ ok(IsChild(child2, child4), "wrong parent/child %p/%p\n", child2, child4);
+ ok(!IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
+ SetWindowLongW(child2, GWL_STYLE, WS_CHILD);
+ ok(IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4);
+ ok(IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4);
+
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
ok(!IsWindow(parent), "parent still exists\n");
ret = SetParent(popup, child1);
ok(ret == desktop, "expected %p, got %p\n", desktop, ret);
check_parents(popup, child1, child1, 0, 0, parent, popup);
-todo_wine
check_active_state(popup, 0, popup);
+ SetActiveWindow(parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+
+ EnableWindow(child1, FALSE);
+ check_active_state(popup, 0, popup);
+ SetFocus(parent);
+ check_active_state(parent, 0, parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+ EnableWindow(child1, TRUE);
+
+ ShowWindow(child1, SW_MINIMIZE);
+ SetFocus(parent);
+ check_active_state(parent, 0, parent);
+ SetFocus(popup);
+ check_active_state(popup, 0, popup);
+ ShowWindow(child1, SW_HIDE);
+
SetActiveWindow(parent);
SetFocus(parent);
check_active_state(parent, 0, parent);
bret = SetForegroundWindow(popup);
-todo_wine {
- ok(bret || broken(!bret), "SetForegroundWindow() failed\n");
- if (!bret)
- check_active_state(popup, 0, popup);
- else
- check_active_state(popup, popup, popup);
- }
+ ok(bret, "SetForegroundWindow() failed\n");
+ check_active_state(popup, popup, popup);
ok(DestroyWindow(parent), "DestroyWindow() failed\n");
static LRESULT WINAPI StyleCheckProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
- LPCREATESTRUCT lpcs;
+ LPCREATESTRUCTA lpcs;
LPSTYLESTRUCT lpss;
switch (msg)
{
case WM_NCCREATE:
case WM_CREATE:
- lpcs = (LPCREATESTRUCT)lparam;
+ lpcs = (LPCREATESTRUCTA)lparam;
lpss = lpcs->lpCreateParams;
if (lpss)
{
}
break;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static ATOM atomStyleCheckClass;
static void register_style_check_class(void)
{
- WNDCLASS wc =
+ WNDCLASSA wc =
{
0,
StyleCheckProc,
0,
0,
- GetModuleHandle(NULL),
+ GetModuleHandleA(NULL),
NULL,
- LoadCursor(NULL, IDC_ARROW),
+ LoadCursorA(0, (LPCSTR)IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE+1),
NULL,
- TEXT("WineStyleCheck"),
+ "WineStyleCheck",
};
-
- atomStyleCheckClass = RegisterClass(&wc);
+
+ atomStyleCheckClass = RegisterClassA(&wc);
assert(atomStyleCheckClass);
}
if (dwStyleIn & WS_CHILD)
{
- hwndParent = CreateWindowEx(0, MAKEINTATOM(atomStyleCheckClass), NULL,
+ hwndParent = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
}
- hwnd = CreateWindowEx(dwExStyleIn, MAKEINTATOM(atomStyleCheckClass), NULL,
+ hwnd = CreateWindowExA(dwExStyleIn, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
dwStyleIn, 0, 0, 0, 0, hwndParent, NULL, NULL, &ss);
assert(hwnd);
flush_events( TRUE );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
/* try setting the styles explicitly */
- SetWindowLong( hwnd, GWL_EXSTYLE, dwExStyleIn );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA( hwnd, GWL_EXSTYLE, dwExStyleIn );
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_EX_WINDOWEDGE can't always be changed */
if (dwExStyleIn & WS_EX_DLGMODALFRAME)
dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
- SetWindowLong( hwnd, GWL_STYLE, dwStyleIn );
- dwActualStyle = GetWindowLong(hwnd, GWL_STYLE);
- dwActualExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA( hwnd, GWL_STYLE, dwStyleIn );
+ dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
+ dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_CLIPSIBLINGS can't be reset on top-level windows */
if ((dwStyleIn & (WS_CHILD|WS_POPUP)) == WS_CHILD) dwStyleOut = dwStyleIn;
else dwStyleOut = dwStyleIn | WS_CLIPSIBLINGS;
HWND hwnd, parent = 0;
if (style_in & WS_CHILD)
- parent = CreateWindowEx(0, "static", NULL, WS_OVERLAPPEDWINDOW,
+ parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW,
0, 0, 0, 0, NULL, NULL, NULL, NULL);
dlg_data.dt.style = style_in;
dlg_data.class_atom = 0;
dlg_data.caption[0] = 0;
- hwnd = CreateDialogIndirectParam(GetModuleHandle(0), &dlg_data.dt, parent, empty_dlg_proc, 0);
+ hwnd = CreateDialogIndirectParamA(GetModuleHandleA(NULL), &dlg_data.dt, parent, empty_dlg_proc, 0);
ok(hwnd != 0, "dialog creation failed, style %#x, exstyle %#x\n", style_in, ex_style_in);
flush_events( TRUE );
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(style == (style_out | DS_3DLOOK), "expected style %#x, got %#x\n", style_out | DS_3DLOOK, style);
ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
/* try setting the styles explicitly */
- SetWindowLong(hwnd, GWL_EXSTYLE, ex_style_in);
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA(hwnd, GWL_EXSTYLE, ex_style_in);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
ok(style == (style_out | DS_3DLOOK), "expected style %#x, got %#x\n", style_out|DS_3DLOOK, style);
/* WS_EX_WINDOWEDGE can't always be changed */
if (ex_style_in & WS_EX_DLGMODALFRAME)
ex_style_out = ex_style_in & ~WS_EX_WINDOWEDGE;
ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
- SetWindowLong(hwnd, GWL_STYLE, style_in);
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ SetWindowLongA(hwnd, GWL_STYLE, style_in);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
/* WS_CLIPSIBLINGS can't be reset on top-level windows */
if ((style_in & (WS_CHILD | WS_POPUP)) == WS_CHILD) style_out = style_in;
else style_out = style_in | WS_CLIPSIBLINGS;
SetRectRgn( clipping, 10, 10, 90, 90);
hdc = GetDC( hwnd1);
/* for a visual touch */
- TextOut( hdc, 0,10, "0123456789", 10);
+ TextOutA( hdc, 0,10, "0123456789", 10);
ScrollDC( hdc, -10, -5, &rc, &cliprc, hrgn, &rcu);
if (winetest_debug > 0) dump_region(hrgn);
/* create a region with what is expected */
hwnd2 = CreateWindowExA(0, "static", NULL,
WS_CHILD| WS_VISIBLE | WS_BORDER ,
50, 50, 100, 100, hwnd1, 0, 0, NULL);
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPSIBLINGS);
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPSIBLINGS);
GetClientRect( hwnd1, &rc);
cliprc=rc;
/* WS_CLIPCHILDREN and SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu,
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_SCROLLCHILDREN | SW_INVALIDATE);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* no SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) & ~WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_INVALIDATE);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
/* WS_CLIPCHILDREN and no SW_SCROLLCHILDREN */
- SetWindowLong( hwnd1, GWL_STYLE, GetWindowLong( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hwnd1, GWL_STYLE, GetWindowLongA( hwnd1, GWL_STYLE) | WS_CLIPCHILDREN );
ValidateRect( hwnd1, NULL);
ValidateRect( hwnd2, NULL);
ScrollWindowEx( hwnd1, -10, -10, &rc, &cliprc, hrgn, &rcu, SW_INVALIDATE);
if (pGetMonitorInfoA)
{
SetLastError(0xdeadbeef);
- rc = GetWindowText(hwndMain2, NULL, 1024);
+ rc = GetWindowTextA(hwndMain2, NULL, 1024);
ok( rc==0, "GetWindowText: rc=%d err=%d\n",rc,GetLastError());
}
else
}
SetLastError(0xdeadbeef);
- hwnd=CreateWindow("LISTBOX", "TestList",
+ hwnd=CreateWindowA("LISTBOX", "TestList",
(LBS_STANDARD & ~LBS_SORT),
0, 0, 100, 100,
NULL, (HMENU)1, NULL, 0);
{
HWND hwnd = 0;
- hwnd = CreateWindowEx(exStyle, class, class, style,
+ hwnd = CreateWindowExA(exStyle, class, class, style,
110, 100,
225, 200,
0,
static BOOL AWR_init(void)
{
- WNDCLASS class;
+ WNDCLASSA class;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = DefWindowProcA;
class.cbClsExtra = 0;
class.cbWndExtra = 0;
class.hInstance = 0;
- class.hIcon = LoadIcon (0, IDI_APPLICATION);
- class.hCursor = LoadCursor (0, IDC_ARROW);
+ class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
class.hbrBackground = 0;
class.lpszMenuName = 0;
class.lpszClassName = szAWRClass;
-
- if (!RegisterClass (&class)) {
+
+ if (!RegisterClassA(&class)) {
ok(FALSE, "RegisterClass failed\n");
return FALSE;
}
if (!hmenu)
return FALSE;
ok(hmenu != 0, "Failed to create menu\n");
- ok(AppendMenu(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n");
-
+ ok(AppendMenuA(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n");
+
return TRUE;
}
}
return 0;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
/* Ensure we exit from RedrawNow regardless of invalidated area */
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "RedrawWindowClass";
EndPaint(hwnd, &ps);
return 0;
}
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static void zero_parentdc_stat(struct parentdc_stat *t)
clsMain.cbWndExtra = 0;
clsMain.hInstance = GetModuleHandleA(0);
clsMain.hIcon = 0;
- clsMain.hCursor = LoadCursorA(0, IDC_ARROW);
+ clsMain.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
clsMain.hbrBackground = GetStockObject(WHITE_BRUSH);
clsMain.lpszMenuName = NULL;
clsMain.lpszClassName = "ParentDcMainWindowClass";
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "ParentDcWindowClass";
MINMAXINFO *minmax;
if (msg != WM_GETMINMAXINFO)
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
minmax = (MINMAXINFO *)lp;
- if ((GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD))
+ if ((GetWindowLongA(hwnd, GWL_STYLE) & WS_CHILD))
{
minmax->ptReserved.x = 0;
minmax->ptReserved.y = 0;
minmax->ptMinTrackSize.y = 100;
}
else
- DefWindowProc(hwnd, msg, wp, lp);
+ DefWindowProcA(hwnd, msg, wp, lp);
return 1;
}
GetWindowRect( hwnd, &rect );
ok( !rect.left && !rect.top && !rect.right && !rect.bottom,
"wrong rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
case WM_NCCREATE:
case WM_CREATE:
"wrong rect %d,%d-%d,%d / %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom,
expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
case WM_NCCALCSIZE:
{
ok( !memcmp( &rect, r, sizeof(rect) ),
"passed rect %d,%d-%d,%d doesn't match window rect %d,%d-%d,%d\n",
r->left, r->top, r->right, r->bottom, rect.left, rect.top, rect.right, rect.bottom );
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
default:
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
}
static void test_CreateWindow(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND hwnd, parent;
HMENU hmenu;
RECT rc, rc_minmax;
ok(res, "GetMenu error %d\n", GetLastError())
#define expect_style(window, style)\
- ok((ULONG)GetWindowLong(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLong(window, GWL_STYLE))
+ ok((ULONG)GetWindowLongA(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLongA(window, GWL_STYLE))
#define expect_ex_style(window, ex_style)\
- ok((ULONG)GetWindowLong(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLong(window, GWL_EXSTYLE))
+ ok((ULONG)GetWindowLongA(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLongA(window, GWL_EXSTYLE))
#define expect_gle_broken_9x(gle)\
ok(GetLastError() == gle ||\
/* WS_CHILD */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
DestroyWindow(hwnd);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, 1);
/* WS_POPUP */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
/* WS_CHILD | WS_POPUP */
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, (HMENU)1, 0, NULL);
ok(!hwnd || broken(hwnd != 0 /* Win9x */), "CreateWindowEx should fail\n");
expect_gle_broken_9x(ERROR_INVALID_MENU_HANDLE);
hmenu = CreateMenu();
assert(hmenu != 0);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
+ hwnd = CreateWindowExA(0, "static", NULL, WS_CHILD | WS_POPUP | WS_CAPTION,
0, 0, 100, 100, parent, hmenu, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(hwnd, hmenu);
cls.lpfnWndProc = minmax_wnd_proc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "MinMax_WndClass";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
SetLastError(0xdeadbeef);
- parent = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ parent = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
0, 0, 100, 100, 0, 0, 0, NULL);
ok(parent != 0, "CreateWindowEx error %d\n", GetLastError());
expect_menu(parent, 0);
expect_ex_style(parent, WS_EX_WINDOWEDGE);
memset(&minmax, 0, sizeof(minmax));
- SendMessage(parent, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
+ SendMessageA(parent, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
SetRect(&rc_minmax, 0, 0, minmax.ptMaxSize.x, minmax.ptMaxSize.y);
ok(IsRectEmpty(&rc_minmax), "ptMaxSize is not empty\n");
SetRect(&rc_minmax, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y);
trace("creating child with rect (%d,%d-%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
SetLastError(0xdeadbeef);
- hwnd = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
+ hwnd = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
parent, (HMENU)1, 0, NULL);
ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
expect_ex_style(hwnd, WS_EX_WINDOWEDGE);
memset(&minmax, 0, sizeof(minmax));
- SendMessage(hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
+ SendMessageA(hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax);
SetRect(&rc_minmax, 0, 0, minmax.ptMaxTrackSize.x, minmax.ptMaxTrackSize.y);
GetWindowRect(hwnd, &rc);
cls.lpfnWndProc = winsizes_wnd_proc;
cls.lpszClassName = "Sizes_WndClass";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
expected_cx = expected_cy = 200000;
SetRect( &expected_rect, 0, 0, 200000, 200000 );
/* we need a parent at 0,0 so that child coordinates match */
DestroyWindow(parent);
- parent = CreateWindowEx(0, "MinMax_WndClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
+ parent = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL);
ok(parent != 0, "CreateWindowEx error %d\n", GetLastError());
expected_cx = 100;
ReleaseDC( parent, hdc );
DestroyWindow( parent );
SetLastError( 0xdeadbeef );
- parent = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_LAYOUTRTL, "static", NULL, WS_POPUP,
+ parent = CreateWindowExA(WS_EX_APPWINDOW | WS_EX_LAYOUTRTL, "static", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, 0, NULL);
ok( parent != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( parent, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
res = pGetProcessDefaultLayout( &layout );
ok( res, "GetProcessDefaultLayout failed err %u\n", GetLastError ());
ok( layout == LAYOUT_RTL, "GetProcessDefaultLayout wrong layout %x\n", layout );
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
DestroyWindow( hwnd );
- hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+ hwnd = CreateWindowExA(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
0, 0, 100, 100, parent, 0, 0, NULL);
ok( hwnd != 0, "creation failed err %u\n", GetLastError());
expect_ex_style( hwnd, WS_EX_APPWINDOW );
DestroyWindow(parent);
- UnregisterClass("MinMax_WndClass", GetModuleHandle(0));
- UnregisterClass("Sizes_WndClass", GetModuleHandle(0));
+ UnregisterClassA("MinMax_WndClass", GetModuleHandleA(NULL));
+ UnregisterClassA("Sizes_WndClass", GetModuleHandleA(NULL));
#undef expect_gle_broken_9x
#undef expect_menu
WNDPROC old_window_procW;
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(NULL, GWLP_WNDPROC, 0);
+ retval = SetWindowLongPtrA(NULL, GWLP_WNDPROC, 0);
ok(!retval, "SetWindowLongPtr on invalid window handle should have returned 0 instead of 0x%lx\n", retval);
ok(check_error(GetLastError(), ERROR_INVALID_WINDOW_HANDLE),
"SetWindowLongPtr should have set error to ERROR_INVALID_WINDOW_HANDLE instead of %d\n", GetLastError());
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(hwndMain, 0xdeadbeef, 0);
+ retval = SetWindowLongPtrA(hwndMain, 0xdeadbeef, 0);
ok(!retval, "SetWindowLongPtr on invalid index should have returned 0 instead of 0x%lx\n", retval);
ok(check_error(GetLastError(), ERROR_INVALID_INDEX),
"SetWindowLongPtr should have set error to ERROR_INVALID_INDEX instead of %d\n", GetLastError());
SetLastError(0xdeadbeef);
- retval = SetWindowLongPtr(hwndMain, GWLP_WNDPROC, 0);
+ retval = SetWindowLongPtrA(hwndMain, GWLP_WNDPROC, 0);
ok((WNDPROC)retval == main_window_procA || broken(!retval), /* win9x */
"SetWindowLongPtr on invalid window proc should have returned address of main_window_procA instead of 0x%lx\n", retval);
ok(GetLastError() == 0xdeadbeef, "SetWindowLongPtr shouldn't have set the last error, instead of setting it to %d\n", GetLastError());
- retval = GetWindowLongPtr(hwndMain, GWLP_WNDPROC);
+ retval = GetWindowLongPtrA(hwndMain, GWLP_WNDPROC);
ok((WNDPROC)retval == main_window_procA,
"SetWindowLongPtr on invalid window proc shouldn't have changed the value returned by GetWindowLongPtr, instead of changing it to 0x%lx\n", retval);
ok(!IsWindowUnicode(hwndMain), "hwndMain shouldn't be Unicode\n");
ok(IsWindowUnicode(hwndMain), "hwndMain should now be Unicode\n");
/* set it back to ANSI */
- SetWindowLongPtr(hwndMain, GWLP_WNDPROC, 0);
+ SetWindowLongPtrA(hwndMain, GWLP_WNDPROC, 0);
}
}
SetRect(&rcMain, 120, 120, 210, 210);
- hwnd = CreateWindowEx(0, "MainWindowClass", NULL,
+ hwnd = CreateWindowExA(0, "MainWindowClass", NULL,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_POPUP,
rcMain.left, rcMain.top,
0, 0, 0, NULL);
assert(hwnd);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(!(style & WS_VISIBLE), "window should not be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_SHOW);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
ShowWindow(hwnd, SW_RESTORE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(!(style & WS_DISABLED), "window should not be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = EnableWindow(hwnd, FALSE);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom,
rc.left, rc.top, rc.right, rc.bottom);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
GetWindowRect(hwnd, &rc);
ok(!EqualRect(&rcMain, &rc), "rects shouldn't match\n");
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(style & WS_MINIMIZE, "window should be minimized\n");
ret = ShowWindow(hwnd, SW_RESTORE);
ok(ret, "not expected ret: %lu\n", ret);
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
ok(style & WS_DISABLED, "window should be disabled\n");
ok(style & WS_VISIBLE, "window should be visible\n");
ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom,
rc.left, rc.top, rc.right, rc.bottom);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
ok(IsWindow(hwnd), "window should exist\n");
ret = EnableWindow(hwnd, TRUE);
ok(ret, "not expected ret: %lu\n", ret);
- ret = DefWindowProc(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+ ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
ok(!ret, "not expected ret: %lu\n", ret);
ok(!IsWindow(hwnd), "window should not exist\n");
}
static void test_gettext(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
LPCSTR clsname = "gettexttest";
HWND hwnd;
LRESULT r;
memset( &cls, 0, sizeof cls );
- cls.lpfnWndProc = DefWindowProc;
+ cls.lpfnWndProc = DefWindowProcA;
cls.lpszClassName = clsname;
- cls.hInstance = GetModuleHandle(NULL);
+ cls.hInstance = GetModuleHandleA(NULL);
- if (!RegisterClass( &cls )) return;
+ if (!RegisterClassA( &cls )) return;
- hwnd = CreateWindow( clsname, "test text", WS_OVERLAPPED, 0, 0, 10, 10, 0, NULL, NULL, NULL);
+ hwnd = CreateWindowA( clsname, "test text", WS_OVERLAPPED, 0, 0, 10, 10, 0, NULL, NULL, NULL);
ok( hwnd != NULL, "window was null\n");
- r = SendMessage( hwnd, WM_GETTEXT, 0x10, 0x1000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x10, 0x1000);
ok( r == 0, "settext should return zero\n");
- r = SendMessage( hwnd, WM_GETTEXT, 0x10000, 0);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x10000, 0);
ok( r == 0, "settext should return zero (%ld)\n", r);
- r = SendMessage( hwnd, WM_GETTEXT, 0xff000000, 0x1000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0xff000000, 0x1000);
ok( r == 0, "settext should return zero (%ld)\n", r);
- r = SendMessage( hwnd, WM_GETTEXT, 0x1000, 0xff000000);
+ r = SendMessageA( hwnd, WM_GETTEXT, 0x1000, 0xff000000);
ok( r == 0, "settext should return zero (%ld)\n", r);
DestroyWindow(hwnd);
- UnregisterClass( clsname, NULL );
+ UnregisterClassA( clsname, NULL );
}
parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT)
{
if (msg.hwnd == hgrandparent) grandparent_wm_paint = TRUE;
if (msg.hwnd == hparent) parent_wm_paint = TRUE;
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(parent_wm_paint, "WM_PAINT should have been received in parent\n");
ok(!grandparent_wm_paint, "WM_PAINT should NOT have been received in grandparent\n");
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = classNameA;
parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE;
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT)
{
if (msg.hwnd == hgrandparent) grandparent_wm_paint = TRUE;
if (msg.hwnd == hparent) parent_wm_paint = TRUE;
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(parent_wm_paint, "WM_PAINT should have been received in parent\n");
ok(!grandparent_wm_paint, "WM_PAINT should NOT have been received in grandparent\n");
return 1;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void test_Expose(void)
switch(msg)
{
case WM_CREATE:
- ncredrawflags = *(UINT *) (((CREATESTRUCT *)lParam)->lpCreateParams);
+ ncredrawflags = *(UINT *) (((CREATESTRUCTA *)lParam)->lpCreateParams);
return 0;
case WM_NCPAINT:
RedrawWindow(hwnd, NULL, NULL, ncredrawflags);
EndPaint(hwnd, &ps);
return 0;
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProcA(hwnd, msg, wParam, lParam);
}
static void run_NCRedrawLoop(UINT flags)
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
flush_events( FALSE );
- while(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE) != 0)
+ while (PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE))
{
if (msg.message == WM_PAINT) loopcount++;
if (loopcount >= 100) break;
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT);
}
if (flags == (RDW_INVALIDATE | RDW_FRAME))
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = 0;
- wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ wndclass.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0,0,0,0, 0, 0, 0, NULL);
assert(hwnd);
- hinst = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
- ok(hinst == 0 || broken(hinst == GetModuleHandle(0)), /* win9x */ "expected 0, got %p\n", hinst);
+ hinst = (HINSTANCE)GetWindowLongPtrA(hwnd, GWLP_HINSTANCE);
+ ok(hinst == 0 || broken(hinst == GetModuleHandleA(NULL)), /* win9x */ "expected 0, got %p\n", hinst);
buf1[0] = 0;
SetLastError(0xdeadbeef);
- ret1 = GetModuleFileName(hinst, buf1, sizeof(buf1));
+ ret1 = GetModuleFileNameA(hinst, buf1, sizeof(buf1));
ok(ret1, "GetModuleFileName error %u\n", GetLastError());
buf2[0] = 0;
ok(ret1 == ret2 || broken(ret2 == ret1 + 1), /* win98 */ "%u != %u\n", ret1, ret2);
ok(!strcmp(buf1, buf2), "%s != %s\n", buf1, buf2);
}
- hinst = GetModuleHandle(0);
+ hinst = GetModuleHandleA(NULL);
SetLastError(0xdeadbeef);
- ret2 = GetModuleFileName(hinst, buf2, ret1 - 2);
+ ret2 = GetModuleFileNameA(hinst, buf2, ret1 - 2);
ok(ret2 == ret1 - 2 || broken(ret2 == ret1 - 3), /* win98 */
"expected %u, got %u\n", ret1 - 2, ret2);
ok(GetLastError() == 0xdeadbeef /* XP */ ||
"expected 0xdeadbeef or ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
- ret2 = GetModuleFileName(hinst, buf2, 0);
+ ret2 = GetModuleFileNameA(hinst, buf2, 0);
ok(!ret2, "GetModuleFileName should return 0\n");
ok(GetLastError() == 0xdeadbeef /* XP */ ||
GetLastError() == ERROR_INSUFFICIENT_BUFFER, /* win2k3, vista */
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef), /* win9x */
"expected ERROR_INVALID_WINDOW_HANDLE, got %u\n", GetLastError());
- hwnd = FindWindow("Shell_TrayWnd", NULL);
+ hwnd = FindWindowA("Shell_TrayWnd", NULL);
ok(IsWindow(hwnd) || broken(!hwnd), "got invalid tray window %p\n", hwnd);
SetLastError(0xdeadbeef);
ret1 = pGetWindowModuleFileNameA(hwnd, buf1, sizeof(buf1));
if (!ret1) /* inter-process GetWindowModuleFileName works on win9x, so don't test the desktop there */
{
- ret1 = GetModuleFileName(0, buf1, sizeof(buf1));
+ ret1 = GetModuleFileNameA(0, buf1, sizeof(buf1));
hwnd = GetDesktopWindow();
ok(IsWindow(hwnd), "got invalid desktop window %p\n", hwnd);
SetLastError(0xdeadbeef);
"parent shouldn't have parent %p\n", pGetAncestor(parent, GA_PARENT) );
trace("parent %p root %p desktop %p\n", parent, root, desktop);
if (!GetClassNameA( parent, buffer, sizeof(buffer) )) buffer[0] = 0;
- ok( !lstrcmpi( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
+ ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
GetWindowRect( parent, &rect );
ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
"wrong parent rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
ok( !ret, "GetLayeredWindowAttributes should fail on non-layered window\n" );
ret = pSetLayeredWindowAttributes( hwnd, 0, 0, LWA_ALPHA );
ok( !ret, "SetLayeredWindowAttributes should fail on non-layered window\n" );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
/* clearing WS_EX_LAYERED resets attributes */
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
SetLastError( 0xdeadbeef );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on no longer layered window\n" );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
ok( !ret, "GetLayeredWindowAttributes should fail on layered but not initialized window\n" );
ret = pUpdateLayeredWindow( hwnd, 0, NULL, &sz, hdc, &pt, 0, NULL, ULW_OPAQUE );
ok( flags == 0, "wrong flags %x\n", flags );
/* default alpha and color key is 0 */
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
- SetWindowLong( hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
ret = pSetLayeredWindowAttributes( hwnd, 0x222222, 55, 0 );
ok( ret, "SetLayeredWindowAttributes should succeed on layered window\n" );
ret = pGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags );
break;
}
}
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void test_fullscreen(void)
static const DWORD t_ex_style[] = {
0, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW
};
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND hwnd;
int i, j;
POINT pt;
cls.lpfnWndProc = fullscreen_wnd_proc;
cls.cbClsExtra = 0;
cls.cbWndExtra = 0;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = "fullscreen_class";
- RegisterClass(&cls);
+ RegisterClassA(&cls);
for (i = 0; i < sizeof(t_style)/sizeof(t_style[0]); i++)
{
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX;
hwnd = CreateWindowExA(ex_style, "fullscreen_class", NULL, style,
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
- GetDesktopWindow(), 0, GetModuleHandle(0), NULL);
+ GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom);
}
}
- UnregisterClass("fullscreen_class", GetModuleHandle(0));
+ UnregisterClassA("fullscreen_class", GetModuleHandleA(NULL));
}
static BOOL test_thick_child_got_minmax;
LONG expectedWidth;
LONG expectedHeight;
WNDCLASSA cls;
- LPCTSTR className = "THICK_CHILD_CLASS";
+ static const char className[] = "THICK_CHILD_CLASS";
int i;
LONG adjustedStyle;
static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = {
cls.cbWndExtra = 0;
cls.hInstance = GetModuleHandleA(0);
cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszMenuName = NULL;
cls.lpszClassName = className;
test_thick_child_got_minmax = FALSE;
SetLastError(0xdeadbeef);
- childWindow = CreateWindowEx( exStyles[i], className, "", styles[i], 0, 0, 0, 0, parentWindow, 0, GetModuleHandleA(0), NULL );
+ childWindow = CreateWindowExA( exStyles[i], className, "", styles[i], 0, 0, 0, 0, parentWindow, 0, GetModuleHandleA(0), NULL );
ok(childWindow != NULL, "Failed to create child window, error: %u\n", GetLastError());
ok(test_thick_child_got_minmax, "Got no WM_GETMINMAXINFO\n");
success = DestroyWindow(childWindow);
ok(success,"DestroyWindow call failed, error: %u\n", GetLastError());
}
- ok(UnregisterClass(className, GetModuleHandleA(0)),"UnregisterClass call failed\n");
+ ok(UnregisterClassA(className, GetModuleHandleA(NULL)),"UnregisterClass call failed\n");
}
static void test_handles( HWND full_hwnd )
hwndOwner = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- NULL, 0, GetModuleHandle(0), NULL);
+ NULL, 0, GetModuleHandleA(NULL), NULL);
hwndPopup1 = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- hwndOwner, 0, GetModuleHandle(0), NULL);
+ hwndOwner, 0, GetModuleHandleA(NULL), NULL);
hwndPopup2 = CreateWindowExA(0, "MainWindowClass", NULL,
WS_VISIBLE | WS_POPUPWINDOW,
100, 100, 200, 200,
- hwndPopup1, 0, GetModuleHandle(0), NULL);
+ hwndPopup1, 0, GetModuleHandleA(NULL), NULL);
ok( GetLastActivePopup(hwndOwner) == hwndPopup2, "wrong last active popup\n" );
DestroyWindow( hwndPopup2 );
DestroyWindow( hwndPopup1 );
static LRESULT WINAPI my_httrasparent_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
if (msg == WM_NCHITTEST) return HTTRANSPARENT;
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static LRESULT WINAPI my_window_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
- return DefWindowProc(hwnd, msg, wp, lp);
+ return DefWindowProcA(hwnd, msg, wp, lp);
}
static void create_window_tree(HWND parent, HWND *window, int size)
for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
{
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_window", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "my_window", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_window", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_window", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_httrasparent", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "my_httrasparent", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(0, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(0, "Static", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(0, "Static", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
assert(pos < size);
- window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Static", NULL, style[i] | WS_CHILD,
+ window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "Static", NULL, style[i] | WS_CHILD,
0, 0, 100, 100, parent, 0, 0, NULL);
ok(window[pos] != 0, "CreateWindowEx failed\n");
pos++;
struct window_attributes
{
char class_name[128];
- int is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent;
+ BOOL is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent;
};
static void get_window_attributes(HWND hwnd, struct window_attributes *attrs)
{
DWORD style, ex_style, hittest;
- style = GetWindowLong(hwnd, GWL_STYLE);
- ex_style = GetWindowLong(hwnd, GWL_EXSTYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
+ ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
attrs->class_name[0] = 0;
- GetClassName(hwnd, attrs->class_name, sizeof(attrs->class_name));
- hittest = SendMessage(hwnd, WM_NCHITTEST, 0, 0);
+ GetClassNameA(hwnd, attrs->class_name, sizeof(attrs->class_name));
+ hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, 0);
attrs->is_visible = (style & WS_VISIBLE) != 0;
attrs->is_enabled = (style & WS_DISABLED) == 0;
- attrs->is_groupbox = !lstrcmpi(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
+ attrs->is_groupbox = !lstrcmpiA(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
attrs->is_httransparent = hittest == HTTRANSPARENT;
attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0;
}
int found_invisible, found_disabled, found_groupbox, found_httransparent, found_extransparent;
int ret, i;
- ret = GetClassInfo(0, "Button", &cls);
+ ret = GetClassInfoA(0, "Button", &cls);
ok(ret, "GetClassInfo(Button) failed\n");
cls.lpszClassName = "my_button";
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_button) failed\n");
cls.lpszClassName = "my_httrasparent";
cls.lpfnWndProc = my_httrasparent_proc;
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_httrasparent) failed\n");
cls.lpszClassName = "my_window";
cls.lpfnWndProc = my_window_proc;
- ret = RegisterClass(&cls);
+ ret = RegisterClassA(&cls);
ok(ret, "RegisterClass(my_window) failed\n");
- parent = CreateWindowEx(0, "MainWindowClass", NULL,
+ parent = CreateWindowExA(0, "MainWindowClass", NULL,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE,
100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
+ 0, 0, GetModuleHandleA(NULL), NULL);
ok(parent != 0, "CreateWindowEx failed\n");
trace("parent %p\n", parent);
todo_wine
ok(found_extransparent, "found %d extransparent windows\n", found_extransparent);
- ret = UnregisterClass("my_button", cls.hInstance);
+ ret = UnregisterClassA("my_button", cls.hInstance);
ok(ret, "UnregisterClass(my_button) failed\n");
- ret = UnregisterClass("my_httrasparent", cls.hInstance);
+ ret = UnregisterClassA("my_httrasparent", cls.hInstance);
ok(ret, "UnregisterClass(my_httrasparent) failed\n");
- ret = UnregisterClass("my_window", cls.hInstance);
+ ret = UnregisterClassA("my_window", cls.hInstance);
ok(ret, "UnregisterClass(my_window) failed\n");
}
RECT client_rect;
/* Create test windows */
- wnd = CreateWindow("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
+ wnd = CreateWindowA("static", "test1", WS_POPUP, pos.x, pos.y, width, height, NULL, NULL, NULL, NULL);
ok(wnd != NULL, "Failed %p\n", wnd);
- wnd0 = CreateWindow("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
+ wnd0 = CreateWindowA("static", "test2", WS_POPUP, 0, 0, width, height, NULL, NULL, NULL, NULL);
ok(wnd0 != NULL, "Failed %p\n", wnd);
- dwnd = CreateWindow("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
+ dwnd = CreateWindowA("static", "test3", 0, 200, 300, 150, 150, NULL, NULL, NULL, NULL);
DestroyWindow(dwnd);
ok(dwnd != NULL, "Failed %p\n", dwnd);
DestroyWindow(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);
+}
+
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
if (!RegisterWindowClasses()) assert(0);
+ hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
+ WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
+ WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE,
+ 100, 100, 200, 200,
+ 0, 0, GetModuleHandleA(NULL), NULL);
+ assert( hwndMain );
+
+ if(!SetForegroundWindow(hwndMain)) {
+ /* workaround for foreground lock timeout */
+ INPUT input[2];
+ UINT events_no;
+
+ memset(input, 0, sizeof(input));
+ input[0].type = INPUT_MOUSE;
+ U(input[0]).mi.dx = 101;
+ U(input[0]).mi.dy = 101;
+ U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
+ input[0].type = INPUT_MOUSE;
+ U(input[0]).mi.dx = 101;
+ U(input[0]).mi.dy = 101;
+ U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTUP;
+ events_no = SendInput(2, input, sizeof(input[0]));
+ ok(events_no == 2, "SendInput returned %d\n", events_no);
+ ok(SetForegroundWindow(hwndMain), "SetForegroundWindow failed\n");
+ }
+
SetLastError(0xdeafbeef);
GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC);
is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED);
test_FindWindowEx();
test_SetParent();
- hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
- WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
- WS_MAXIMIZEBOX | WS_POPUP,
- 100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2",
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_POPUP,
100, 100, 200, 200,
- 0, 0, GetModuleHandle(0), NULL);
- assert( hwndMain );
+ 0, 0, GetModuleHandleA(NULL), NULL);
assert( hwndMain2 );
our_pid = GetWindowThreadProcessId(hwndMain, NULL);
test_winregion();
test_map_points();
test_update_region();
+ test_window_without_child_style();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);
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 = "WinStationClass";
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
print_object( d1 );
- d2 = CreateDesktop( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
+ d2 = CreateDesktopA( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
trace( "created desktop %p\n", d2 );
ok( d2 != 0, "CreateDesktop failed\n" );
TRUE, DUPLICATE_SAME_ACCESS ), "DuplicateHandle failed\n" );
ok( CloseHandle(w2), "closing dup win station handle failed\n" );
- w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
+ w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
le = GetLastError();
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", le );
if (w2 != 0)
"bad last error %d\n", GetLastError() );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
- w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
+ w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
ok( CloseHandle( w2 ), "CloseHandle failed\n" );
}
else if (le == ERROR_ACCESS_DENIED)
win_skip( "Not enough privileges for CreateWindowStation\n" );
- w2 = OpenWindowStation("winsta0", TRUE, WINSTA_ALL_ACCESS );
+ w2 = OpenWindowStationA("winsta0", TRUE, WINSTA_ALL_ACCESS );
ok( w2 != 0, "OpenWindowStation failed\n" );
ok( w2 != w1, "OpenWindowStation returned default handle\n" );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
- w2 = OpenWindowStation("dummy name", TRUE, WINSTA_ALL_ACCESS );
+ w2 = OpenWindowStationA("dummy name", TRUE, WINSTA_ALL_ACCESS );
ok( !w2, "open dummy win station succeeded\n" );
CreateMutexA( NULL, 0, "foobar" );
- w2 = CreateWindowStation("foobar", 0, WINSTA_ALL_ACCESS, NULL );
+ w2 = CreateWindowStationA("foobar", 0, WINSTA_ALL_ACCESS, NULL );
le = GetLastError();
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "create foobar station failed (%u)\n", le );
if (w2 != 0)
{
- w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS );
+ w3 = OpenWindowStationA("foobar", TRUE, WINSTA_ALL_ACCESS );
ok( w3 != 0, "open foobar station failed\n" );
ok( w3 != w2, "open foobar station returned same handle\n" );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
ok( CloseWindowStation( w3 ), "CloseWindowStation failed\n" );
- w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS );
+ w3 = OpenWindowStationA("foobar", TRUE, WINSTA_ALL_ACCESS );
ok( !w3, "open foobar station succeeded\n" );
- w2 = CreateWindowStation("foobar1", 0, WINSTA_ALL_ACCESS, NULL );
+ w2 = CreateWindowStationA("foobar1", 0, WINSTA_ALL_ACCESS, NULL );
ok( w2 != 0, "create foobar station failed\n" );
- w3 = CreateWindowStation("foobar2", 0, WINSTA_ALL_ACCESS, NULL );
+ w3 = CreateWindowStationA("foobar2", 0, WINSTA_ALL_ACCESS, NULL );
ok( w3 != 0, "create foobar station failed\n" );
ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" );
ok( GetHandleInformation( w3, &flags ), "GetHandleInformation failed\n" );
TRUE, DUPLICATE_SAME_ACCESS ), "DuplicateHandle failed\n" );
ok( CloseHandle(d2), "closing dup desktop handle failed\n" );
- d2 = OpenDesktop( "dummy name", 0, TRUE, DESKTOP_ALL_ACCESS );
+ d2 = OpenDesktopA( "dummy name", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( !d2, "open dummy desktop succeeded\n" );
- d2 = CreateDesktop( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
+ d2 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
ok( d2 != 0, "create foobar desktop failed\n" );
SetLastError( 0xdeadbeef );
ok( !CloseWindowStation( (HWINSTA)d2 ), "CloseWindowStation succeeded on desktop\n" );
"bad last error %d\n", GetLastError() );
SetLastError( 0xdeadbeef );
- d3 = CreateDesktop( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
+ d3 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
ok( d3 != 0, "create foobar desktop again failed\n" );
ok( GetLastError() == 0xdeadbeef, "bad last error %d\n", GetLastError() );
ok( CloseDesktop( d3 ), "CloseDesktop failed\n" );
- d3 = OpenDesktop( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
+ d3 = OpenDesktopA( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( d3 != 0, "open foobar desktop failed\n" );
ok( d3 != d2, "open foobar desktop returned same handle\n" );
ok( CloseDesktop( d2 ), "CloseDesktop failed\n" );
ok( CloseDesktop( d3 ), "CloseDesktop failed\n" );
- d3 = OpenDesktop( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
+ d3 = OpenDesktopA( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
ok( !d3, "open foobar desktop succeeded\n" );
ok( !CloseHandle(d1), "closing thread desktop handle succeeded\n" );
trace( "get other thread desktop: %p\n", GetThreadDesktop(id) );
WaitForSingleObject( hthread, INFINITE );
CloseHandle( hthread );
+
+ /* clean side effect */
+ SetProcessWindowStation( w1 );
}
/* Enumeration tests */
static void test_enumstations(void)
{
- BOOL ret;
+ DWORD ret;
+ HWINSTA hwinsta;
if (0) /* Crashes instead */
{
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08x\n", GetLastError());
}
+ hwinsta = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
+ ret = GetLastError();
+ ok(hwinsta != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
+ if (!hwinsta)
+ {
+ win_skip("Not enough privileges for CreateWindowStation\n");
+ return;
+ }
+
SetLastError(0xdeadbeef);
ret = EnumWindowStationsA(open_window_station_callbackA, 0x12345);
ok(ret == 0x12345, "EnumWindowStationsA returned %x\n", ret);
DWORD size;
BOOL ret;
- desk = CreateDesktop("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
+ desk = CreateDesktopA("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
ok(desk != 0, "open foobarTest desktop failed\n");
strcpy(buffer, "blahblah");
ok(CloseDesktop(desk), "CloseDesktop failed\n");
}
+static void test_inputdesktop(void)
+{
+ HDESK input_desk, old_input_desk, thread_desk, old_thread_desk, new_desk;
+ DWORD ret;
+ CHAR name[1024];
+ INPUT inputs[1];
+
+ inputs[0].type = INPUT_KEYBOARD;
+ U(inputs[0]).ki.wVk = 0;
+ U(inputs[0]).ki.wScan = 0x3c0;
+ U(inputs[0]).ki.dwFlags = KEYEVENTF_UNICODE;
+
+ /* OpenInputDesktop creates new handles for each calls */
+ old_input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(old_input_desk != NULL, "OpenInputDesktop failed!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(old_input_desk, UOI_NAME, name, 1024, NULL);
+ ok(ret, "GetUserObjectInformation failed!\n");
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(input_desk != NULL, "OpenInputDesktop failed!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
+ ok(ret, "GetUserObjectInformation failed!\n");
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ ok(old_input_desk != input_desk, "returned the same handle!\n");
+ ret = CloseDesktop(input_desk);
+ ok(ret, "CloseDesktop failed!\n");
+
+ /* by default, GetThreadDesktop is the input desktop, SendInput should success. */
+ old_thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(old_thread_desk != NULL, "GetThreadDesktop faile!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(old_thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1, "unexpected return count %d\n", ret);
+
+ /* Set thread desktop to the new desktop, SendInput should fail. */
+ new_desk = CreateDesktopA("new_desk", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
+ ok(new_desk != NULL, "CreateDesktop failed!\n");
+ ret = SetThreadDesktop(new_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk == new_desk, "thread desktop doesn't match!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ if(broken(GetLastError() == 0xdeadbeef))
+ {
+ SetThreadDesktop(old_thread_desk);
+ CloseDesktop(old_input_desk);
+ CloseDesktop(input_desk);
+ CloseDesktop(new_desk);
+ win_skip("Skip tests on NT4\n");
+ return;
+ }
+todo_wine
+ ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
+
+ /* Set thread desktop back to the old thread desktop, SendInput should success. */
+ ret = SetThreadDesktop(old_thread_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk == old_thread_desk, "thread desktop doesn't match!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1, "unexpected return count %d\n", ret);
+
+ /* Set thread desktop to the input desktop, SendInput should success. */
+ ret = SetThreadDesktop(old_input_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk == old_input_desk, "thread desktop doesn't match!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1, "unexpected return count %d\n", ret);
+
+ /* Switch input desktop to the new desktop, SendInput should fail. */
+ ret = SwitchDesktop(new_desk);
+ ok(ret, "SwitchDesktop failed!\n");
+ input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(input_desk != NULL, "OpenInputDesktop failed!\n");
+ ok(input_desk != new_desk, "returned the same handle!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
+ ok(ret, "GetUserObjectInformation failed!\n");
+todo_wine
+ ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
+ ret = CloseDesktop(input_desk);
+ ok(ret, "CloseDesktop failed!\n");
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+todo_wine
+ ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
+
+ /* Set thread desktop to the new desktop, SendInput should success. */
+ ret = SetThreadDesktop(new_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk == new_desk, "thread desktop doesn't match!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1, "unexpected return count %d\n", ret);
+
+ /* Switch input desktop to the old input desktop, set thread desktop to the old
+ * thread desktop, clean side effects. SendInput should success. */
+ ret = SwitchDesktop(old_input_desk);
+ input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(input_desk != NULL, "OpenInputDesktop failed!\n");
+ ok(input_desk != old_input_desk, "returned the same handle!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
+ ok(ret, "GetUserObjectInformation failed!\n");
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ ret = SetThreadDesktop(old_thread_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk == old_thread_desk, "thread desktop doesn't match!\n");
+ memset(name, 0, sizeof(name));
+ ret = GetUserObjectInformationA(thread_desk, UOI_NAME, name, 1024, NULL);
+ ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
+
+ SetLastError(0xdeadbeef);
+ ret = SendInput(1, inputs, sizeof(INPUT));
+ ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
+ ok(ret == 1, "unexpected return count %d\n", ret);
+
+ /* free resources */
+ ret = CloseDesktop(input_desk);
+ ok(ret, "CloseDesktop failed!\n");
+ ret = CloseDesktop(old_input_desk);
+ ok(ret, "CloseDesktop failed!\n");
+ ret = CloseDesktop(new_desk);
+ ok(ret, "CloseDesktop failed!\n");
+}
+
+static void test_inputdesktop2(void)
+{
+ HWINSTA w1, w2;
+ HDESK thread_desk, new_desk, input_desk, hdesk;
+ DWORD ret;
+
+ thread_desk = GetThreadDesktop(GetCurrentThreadId());
+ ok(thread_desk != NULL, "GetThreadDesktop failed!\n");
+ w1 = GetProcessWindowStation();
+ ok(w1 != NULL, "GetProcessWindowStation failed!\n");
+ SetLastError(0xdeadbeef);
+ w2 = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
+ ret = GetLastError();
+ ok(w2 != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
+ if (!w2)
+ {
+ win_skip("Not enough privileges for CreateWindowStation\n");
+ return;
+ }
+
+ ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
+ ok(!ret, "EnumDesktopsA failed!\n");
+ input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(input_desk != NULL, "OpenInputDesktop failed!\n");
+ ret = CloseDesktop(input_desk);
+ ok(ret, "CloseDesktop failed!\n");
+
+ ret = SetProcessWindowStation(w2);
+ ok(ret, "SetProcessWindowStation failed!\n");
+ hdesk = GetThreadDesktop(GetCurrentThreadId());
+ ok(hdesk != NULL, "GetThreadDesktop failed!\n");
+ ok(hdesk == thread_desk, "thread desktop should not change after winstation changed!\n");
+ ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
+
+ new_desk = CreateDesktopA("desk_test", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
+ ok(new_desk != NULL, "CreateDesktop failed!\n");
+ ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
+ ok(!ret, "EnumDesktopsA failed!\n");
+ SetLastError(0xdeadbeef);
+ input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
+ ok(input_desk == NULL, "OpenInputDesktop should fail on non default winstation!\n");
+ ok(GetLastError() == ERROR_INVALID_FUNCTION || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
+
+ hdesk = OpenDesktopA("desk_test", 0, TRUE, DESKTOP_ALL_ACCESS);
+ ok(hdesk != NULL, "OpenDesktop failed!\n");
+ SetLastError(0xdeadbeef);
+ ret = SwitchDesktop(hdesk);
+todo_wine
+ ok(!ret, "Switch to desktop belong to non default winstation should fail!\n");
+todo_wine
+ ok(GetLastError() == ERROR_ACCESS_DENIED || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
+ ret = SetThreadDesktop(hdesk);
+ ok(ret, "SetThreadDesktop failed!\n");
+
+ /* clean side effect */
+ ret = SetThreadDesktop(thread_desk);
+todo_wine
+ ok(ret, "SetThreadDesktop should success even desktop is not belong to process winstation!\n");
+ ret = SetProcessWindowStation(w1);
+ ok(ret, "SetProcessWindowStation failed!\n");
+ ret = SetThreadDesktop(thread_desk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ ret = CloseWindowStation(w2);
+ ok(ret, "CloseWindowStation failed!\n");
+ ret = CloseDesktop(new_desk);
+ ok(ret, "CloseDesktop failed!\n");
+ ret = CloseDesktop(hdesk);
+ ok(ret, "CloseDesktop failed!\n");
+}
+
+static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ if (msg == WM_DESTROY)
+ {
+ trace("destroying hwnd %p\n", hWnd);
+ PostQuitMessage(0);
+ return 0;
+ }
+ return DefWindowProcA( hWnd, msg, wParam, lParam );
+}
+
+typedef struct tag_wnd_param
+{
+ const char *wnd_name;
+ HWND hwnd;
+ HDESK hdesk;
+ HANDLE hevent;
+} wnd_param;
+
+static DWORD WINAPI create_window(LPVOID param)
+{
+ wnd_param *param1 = param;
+ DWORD ret;
+ MSG msg;
+
+ ret = SetThreadDesktop(param1->hdesk);
+ ok(ret, "SetThreadDesktop failed!\n");
+ param1->hwnd = CreateWindowA("test_class", param1->wnd_name, WS_POPUP, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
+ ok(param1->hwnd != 0, "CreateWindowA failed!\n");
+ ret = SetEvent(param1->hevent);
+ ok(ret, "SetEvent failed!\n");
+
+ while (GetMessageA(&msg, 0, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ }
+
+ return 0;
+}
+
+static DWORD set_foreground(HWND hwnd)
+{
+ HWND hwnd_fore;
+ DWORD set_id, fore_id, ret;
+ char win_text[1024];
+
+ hwnd_fore = GetForegroundWindow();
+ GetWindowTextA(hwnd_fore, win_text, 1024);
+ set_id = GetWindowThreadProcessId(hwnd, NULL);
+ fore_id = GetWindowThreadProcessId(hwnd_fore, NULL);
+ trace("\"%s\" %p %08x hwnd %p %08x\n", win_text, hwnd_fore, fore_id, hwnd, set_id);
+ ret = AttachThreadInput(set_id, fore_id, TRUE);
+ trace("AttachThreadInput returned %08x\n", ret);
+ ret = ShowWindow(hwnd, SW_SHOWNORMAL);
+ trace("ShowWindow returned %08x\n", ret);
+ ret = SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
+ trace("set topmost returned %08x\n", ret);
+ ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
+ trace("set notopmost returned %08x\n", ret);
+ ret = SetForegroundWindow(hwnd);
+ trace("SetForegroundWindow returned %08x\n", ret);
+ Sleep(250);
+ AttachThreadInput(set_id, fore_id, FALSE);
+ return ret;
+}
+
+static void test_foregroundwindow(void)
+{
+ HWND hwnd, hwnd_test, partners[2], hwnds[2];
+ HDESK hdesks[2];
+ int thread_desk_id, input_desk_id, hwnd_id;
+ WNDCLASSA wclass;
+ wnd_param param;
+ DWORD ret, timeout, timeout_old;
+ char win_text[1024];
+
+#define DESKTOPS 2
+
+ memset( &wclass, 0, sizeof(wclass) );
+ wclass.lpszClassName = "test_class";
+ wclass.lpfnWndProc = WndProc;
+ RegisterClassA(&wclass);
+ param.wnd_name = "win_name";
+
+ hdesks[0] = GetThreadDesktop(GetCurrentThreadId());
+ ok(hdesks[0] != NULL, "OpenDesktop failed!\n");
+ SetLastError(0xdeadbeef);
+ hdesks[1] = CreateDesktopA("desk2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
+ ret = GetLastError();
+ ok(hdesks[1] != NULL || ret == ERROR_ACCESS_DENIED, "CreateDesktop failed (%u)\n", ret);
+ if(!hdesks[1])
+ {
+ win_skip("Not enough privileges for CreateDesktop\n");
+ return;
+ }
+
+ ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout_old, 0);
+ if(!ret)
+ {
+ win_skip("Skip tests on NT4\n");
+ CloseDesktop(hdesks[1]);
+ return;
+ }
+ trace("old timeout %d\n", timeout_old);
+ timeout = 0;
+ ret = SystemParametersInfoA(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
+ ok(ret, "set foreground lock timeout failed!\n");
+ ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
+ ok(ret, "get foreground lock timeout failed!\n");
+ ok(timeout == 0, "unexpected timeout %d\n", timeout);
+
+ for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
+ {
+ param.hdesk = hdesks[thread_desk_id];
+ param.hevent = CreateEventA(NULL, TRUE, FALSE, NULL);
+ CreateThread(NULL, 0, create_window, ¶m, 0, NULL);
+ ret = WaitForSingleObject(param.hevent, INFINITE);
+ ok(ret == WAIT_OBJECT_0, "wait failed!\n");
+ hwnds[thread_desk_id] = param.hwnd;
+ }
+
+ for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
+ {
+ param.hdesk = hdesks[thread_desk_id];
+ param.hevent = CreateEventA(NULL, TRUE, FALSE, NULL);
+ CreateThread(NULL, 0, create_window, ¶m, 0, NULL);
+ ret = WaitForSingleObject(param.hevent, INFINITE);
+ ok(ret == WAIT_OBJECT_0, "wait failed!\n");
+ partners[thread_desk_id] = param.hwnd;
+ }
+
+ trace("hwnd0 %p hwnd1 %p partner0 %p partner1 %p\n", hwnds[0], hwnds[1], partners[0], partners[1]);
+
+ for (hwnd_id = 0; hwnd_id < DESKTOPS; hwnd_id++)
+ for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
+ for (input_desk_id = 0; input_desk_id < DESKTOPS; input_desk_id++)
+ {
+ trace("testing thread_desk %d input_desk %d hwnd %d\n",
+ thread_desk_id, input_desk_id, hwnd_id);
+ hwnd_test = hwnds[hwnd_id];
+ ret = SetThreadDesktop(hdesks[thread_desk_id]);
+ ok(ret, "set thread desktop failed!\n");
+ ret = SwitchDesktop(hdesks[input_desk_id]);
+ ok(ret, "switch desktop failed!\n");
+ set_foreground(partners[0]);
+ set_foreground(partners[1]);
+ hwnd = GetForegroundWindow();
+ ok(hwnd != hwnd_test, "unexpected foreground window %p\n", hwnd);
+ ret = set_foreground(hwnd_test);
+ hwnd = GetForegroundWindow();
+ GetWindowTextA(hwnd, win_text, 1024);
+ trace("hwnd %p name %s\n", hwnd, win_text);
+ if (input_desk_id == hwnd_id)
+ {
+ if (input_desk_id == thread_desk_id)
+ {
+ ok(ret, "SetForegroundWindow failed!\n");
+ ok(hwnd == hwnd_test , "unexpected foreground window %p\n", hwnd);
+ }
+ else
+ {
+ todo_wine ok(ret, "SetForegroundWindow failed!\n");
+ todo_wine ok(hwnd == 0, "unexpected foreground window %p\n", hwnd);
+ }
+ }
+ else
+ {
+ if (input_desk_id == thread_desk_id)
+ {
+ ok(!ret, "SetForegroundWindow should fail!\n");
+ ok(hwnd == partners[input_desk_id] , "unexpected foreground window %p\n", hwnd);
+ }
+ else
+ {
+ todo_wine ok(!ret, "SetForegroundWindow should fail!\n");
+ todo_wine ok(hwnd == 0, "unexpected foreground window %p\n", hwnd);
+ }
+ }
+ }
+
+ /* Clean up */
+
+ for (thread_desk_id = DESKTOPS - 1; thread_desk_id >= 0; thread_desk_id--)
+ {
+ ret = SetThreadDesktop(hdesks[thread_desk_id]);
+ ok(ret, "set thread desktop failed!\n");
+ SendMessageA(hwnds[thread_desk_id], WM_DESTROY, 0, 0);
+ SendMessageA(partners[thread_desk_id], WM_DESTROY, 0, 0);
+ }
+
+ ret = SwitchDesktop(hdesks[0]);
+ ok(ret, "switch desktop failed!\n");
+ CloseDesktop(hdesks[1]);
+
+ ret = SystemParametersInfoA(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UlongToPtr(timeout_old), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
+ ok(ret, "set foreground lock timeout failed!\n");
+ ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
+ ok(ret, "get foreground lock timeout failed!\n");
+ ok(timeout == timeout_old, "unexpected timeout %d\n", timeout);
+}
+
START_TEST(winstation)
{
/* Check whether this platform supports WindowStation calls */
return;
}
+ test_inputdesktop();
+ test_inputdesktop2();
test_enumstations();
test_enumdesktops();
test_handles();
test_getuserobjectinformation();
+ test_foregroundwindow();
}
static void CharUpperTest(void)
{
- INT_PTR i,out,failed;
+ INT_PTR i, out;
+ BOOL failed = FALSE;
- failed = 0;
for (i=0;i<256;i++)
{
- out = (INT_PTR)CharUpper((LPTSTR)i);
+ out = (INT_PTR)CharUpperA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
- failed = 1;
+ failed = TRUE;
break;
}
}
static void CharLowerTest(void)
{
- INT_PTR i,out,failed;
+ INT_PTR i, out;
+ BOOL failed = FALSE;
- failed = 0;
for (i=0;i<256;i++)
{
- out = (INT_PTR)CharLower((LPTSTR)i);
+ out = (INT_PTR)CharLowerA((LPSTR)i);
/* printf("%0x ",out); */
if ((out >> 16) != 0)
{
- failed = 1;
+ failed = TRUE;
break;
}
}