#define WM_LBTRACKPOINT 0x0131
#endif
+#ifdef __i386__
+#define ARCH "x86"
+#elif defined __x86_64__
+#define ARCH "amd64"
+#else
+#define ARCH "none"
+#endif
+
+static BOOL (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
+static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
+static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
+static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
+static void (WINAPI *pReleaseActCtx)(HANDLE);
+
/* encoded DRAWITEMSTRUCT into an LPARAM */
typedef struct
{
{ 0 }
};
-static int after_end_dialog, test_def_id;
+static BOOL after_end_dialog, test_def_id, paint_loop_done;
static int sequence_cnt, sequence_size;
static struct recvd_message* sequence;
static int log_all_parent_messages;
-static int paint_loop_done;
+static CRITICAL_SECTION sequence_cs;
/* user32 functions */
static HWND (WINAPI *pGetAncestor)(HWND,UINT);
static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
+static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
+static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC);
+static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR);
/* kernel32 functions */
static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA);
GET_PROC(user32, UnhookWinEvent)
GET_PROC(user32, GetMonitorInfoA)
GET_PROC(user32, MonitorFromPoint)
+ GET_PROC(user32, UpdateLayeredWindow)
+ GET_PROC(user32, SetSystemTimer)
+ GET_PROC(user32, KillSystemTimer)
GET_PROC(kernel32, GetCPInfoExA)
{
struct recvd_message *seq;
- if (!sequence)
+ EnterCriticalSection( &sequence_cs );
+ if (!sequence)
{
sequence_size = 10;
sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) );
}
assert(sequence);
- seq = &sequence[sequence_cnt];
+ seq = &sequence[sequence_cnt++];
seq->hwnd = msg->hwnd;
seq->message = msg->message;
seq->flags = msg->flags;
seq->line = line;
seq->descr = msg->descr;
seq->output[0] = 0;
+ LeaveCriticalSection( &sequence_cs );
if (msg->descr)
{
sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
}
}
-
- sequence_cnt++;
}
/* try to make sure pending X events have been processed before continuing */
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 void flush_sequence(void)
{
+ EnterCriticalSection( &sequence_cs );
HeapFree(GetProcessHeap(), 0, sequence);
sequence = 0;
sequence_cnt = sequence_size = 0;
+ LeaveCriticalSection( &sequence_cs );
}
static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
-static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
+static void ok_sequence_(const struct message *expected_list, const char *context, BOOL todo,
const char *file, int line)
{
static const struct recvd_message end_of_sequence;
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_frame_class";
/* test maximization of MDI child with invisible parent */
client_cs.hWindowMenu = 0;
- mdi_client = CreateWindow("MDI_client_class",
+ mdi_client = CreateWindowA("MDI_client_class",
NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
0, 0, 660, 430,
mdi_client, 0, GetModuleHandleA(0), NULL);
ok_sequence(WmCreateMDIchildInvisibleParentSeq, "Create MDI child window with invisible parent", FALSE);
- SendMessage(mdi_client, WM_MDIMAXIMIZE, (WPARAM) mdi_child, 0);
+ SendMessageA(mdi_client, WM_MDIMAXIMIZE, (WPARAM) mdi_child, 0);
ok_sequence(WmMaximizeMDIchildInvisibleParentSeq, "Maximize MDI child window with invisible parent", TRUE);
zoomed = IsZoomed(mdi_child);
ok(zoomed, "wrong zoomed state %d\n", zoomed);
-
+
ShowWindow(mdi_client, SW_SHOW);
ok_sequence(WmShowMDIclientSeq, "Show MDI client window", FALSE);
flush_sequence();
- test_def_id = 1;
- SendMessage(hwnd, WM_NULL, 0, 0);
+ test_def_id = TRUE;
+ SendMessageA(hwnd, WM_NULL, 0, 0);
flush_sequence();
- after_end_dialog = 1;
+ after_end_dialog = TRUE;
EndDialog( hwnd, 0 );
ok_sequence(WmEndCustomDialogSeq, "EndCustomDialog", FALSE);
DestroyWindow(hwnd);
- after_end_dialog = 0;
- test_def_id = 0;
+ after_end_dialog = FALSE;
+ test_def_id = FALSE;
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP,
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL);
UpdateWindow(hwnd);
flush_events();
flush_sequence();
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(0, IDI_APPLICATION));
+ SendMessageA(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconA(0, (LPCSTR)IDI_APPLICATION));
ok_sequence(WmSetIcon_1, "WM_SETICON for shown window with caption", FALSE);
ShowWindow(hwnd, SW_HIDE);
flush_events();
flush_sequence();
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(0, IDI_APPLICATION));
+ SendMessageA(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconA(0, (LPCSTR)IDI_APPLICATION));
ok_sequence(WmSetIcon_2, "WM_SETICON for hidden window with caption", FALSE);
DestroyWindow(hwnd);
flush_sequence();
UpdateWindow(hwnd);
flush_events();
flush_sequence();
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(0, IDI_APPLICATION));
+ SendMessageA(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconA(0, (LPCSTR)IDI_APPLICATION));
ok_sequence(WmSetIcon_2, "WM_SETICON for shown window without caption", FALSE);
ShowWindow(hwnd, SW_HIDE);
flush_events();
flush_sequence();
- SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(0, IDI_APPLICATION));
+ SendMessageA(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconA(0, (LPCSTR)IDI_APPLICATION));
ok_sequence(WmSetIcon_2, "WM_SETICON for hidden window without caption", FALSE);
flush_sequence();
- res = SendMessage(hwnd, 0x3B, 0x8000000b, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x8000000b, 0);
if (!res)
{
todo_wine win_skip( "Message 0x3b not supported\n" );
}
ok_sequence(WmInitEndSession, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x8000000b", TRUE);
ok(res == 1, "SendMessage(hwnd, 0x3B, 0x8000000b, 0) should have returned 1 instead of %ld\n", res);
- res = SendMessage(hwnd, 0x3B, 0x0000000b, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x0000000b, 0);
ok_sequence(WmInitEndSession_2, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000b", TRUE);
ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000b, 0) should have returned 1 instead of %ld\n", res);
- res = SendMessage(hwnd, 0x3B, 0x0000000f, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x0000000f, 0);
ok_sequence(WmInitEndSession_2, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000f", TRUE);
ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000f, 0) should have returned 1 instead of %ld\n", res);
flush_sequence();
- res = SendMessage(hwnd, 0x3B, 0x80000008, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x80000008, 0);
ok_sequence(WmInitEndSession_3, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000008", TRUE);
ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000008, 0) should have returned 2 instead of %ld\n", res);
- res = SendMessage(hwnd, 0x3B, 0x00000008, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x00000008, 0);
ok_sequence(WmInitEndSession_4, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x00000008", TRUE);
ok(res == 2, "SendMessage(hwnd, 0x3B, 0x00000008, 0) should have returned 2 instead of %ld\n", res);
- res = SendMessage(hwnd, 0x3B, 0x80000004, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x80000004, 0);
ok_sequence(WmInitEndSession_3, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000004", TRUE);
ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000004, 0) should have returned 2 instead of %ld\n", res);
- res = SendMessage(hwnd, 0x3B, 0x80000001, 0);
+ res = SendMessageA(hwnd, 0x3B, 0x80000001, 0);
ok_sequence(WmInitEndSession_5, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000001", TRUE);
ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000001, 0) should have returned 2 instead of %ld\n", res);
old_button_proc = cls.lpfnWndProc;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.lpfnWndProc = button_hook_proc;
cls.lpszClassName = "my_button_class";
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
if (!RegisterClassA(&cls)) assert(0);
}
ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
SetFocus(hwnd);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].setfocus, "SetFocus(hwnd) on a button", FALSE);
SetFocus(0);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].killfocus, "SetFocus(0) on a button", FALSE);
ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
- SendMessage(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].setstyle, "BM_SETSTYLE on a button", FALSE);
style = GetWindowLongA(hwnd, GWL_STYLE);
/* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */
ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
- state = SendMessage(hwnd, BM_GETSTATE, 0, 0);
+ state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
ok(state == 0, "expected state 0, got %04x\n", state);
flush_sequence();
- SendMessage(hwnd, BM_SETSTATE, TRUE, 0);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, BM_SETSTATE, TRUE, 0);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].setstate, "BM_SETSTATE/TRUE on a button", FALSE);
- state = SendMessage(hwnd, BM_GETSTATE, 0, 0);
+ state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
ok(state == 0x0004, "expected state 0x0004, got %04x\n", state);
style = GetWindowLongA(hwnd, GWL_STYLE);
flush_sequence();
- SendMessage(hwnd, BM_SETSTATE, FALSE, 0);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, BM_SETSTATE, FALSE, 0);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].clearstate, "BM_SETSTATE/FALSE on a button", FALSE);
- state = SendMessage(hwnd, BM_GETSTATE, 0, 0);
+ state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
ok(state == 0, "expected state 0, got %04x\n", state);
style = GetWindowLongA(hwnd, GWL_STYLE);
style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
- state = SendMessage(hwnd, BM_GETCHECK, 0, 0);
+ state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
flush_sequence();
- SendMessage(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmSetCheckIgnoredSeq, "BM_SETCHECK on a button", FALSE);
- state = SendMessage(hwnd, BM_GETCHECK, 0, 0);
+ state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
style = GetWindowLongA(hwnd, GWL_STYLE);
flush_sequence();
- SendMessage(hwnd, BM_SETCHECK, BST_CHECKED, 0);
- SendMessage(hwnd, WM_APP, 0, 0); /* place a separator mark here */
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ SendMessageA(hwnd, BM_SETCHECK, BST_CHECKED, 0);
+ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(button[i].setcheck, "BM_SETCHECK on a button", FALSE);
- state = SendMessage(hwnd, BM_GETCHECK, 0, 0);
+ state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
if (button[i].style == BS_PUSHBUTTON ||
button[i].style == BS_DEFPUSHBUTTON ||
button[i].style == BS_GROUPBOX ||
old_static_proc = cls.lpfnWndProc;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.lpfnWndProc = static_hook_proc;
cls.lpszClassName = "my_static_class";
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
if (!RegisterClassA(&cls)) assert(0);
}
flush_sequence();
trace("static style %08x\n", static_ctrl[i].style);
- SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
+ SendMessageA(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
ok_sequence(static_ctrl[i].setfont, "WM_SETFONT on a static", FALSE);
DestroyWindow(hwnd);
old_combobox_proc = cls.lpfnWndProc;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.lpfnWndProc = combobox_hook_proc;
cls.lpszClassName = "my_combobox_class";
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
if (!RegisterClassA(&cls)) assert(0);
}
ok(parent != 0, "Failed to create parent window\n");
flush_sequence();
- combo = CreateWindowEx(0, "my_combobox_class", "test", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_HASSTRINGS,
+ combo = CreateWindowExA(0, "my_combobox_class", "test", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_HASSTRINGS,
0, 0, 100, 150, parent, (HMENU)ID_COMBOBOX, 0, NULL);
ok(combo != 0, "Failed to create combobox window\n");
UpdateWindow(combo);
- ret = SendMessage(combo, WM_GETDLGCODE, 0, 0);
+ ret = SendMessageA(combo, WM_GETDLGCODE, 0, 0);
ok(ret == (DLGC_WANTCHARS | DLGC_WANTARROWS), "wrong dlg_code %08lx\n", ret);
- ret = SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item 0");
+ ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 0");
ok(ret == 0, "expected 0, got %ld\n", ret);
- ret = SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item 1");
+ ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 1");
ok(ret == 1, "expected 1, got %ld\n", ret);
- ret = SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)"item 2");
+ ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 2");
ok(ret == 2, "expected 2, got %ld\n", ret);
- SendMessage(combo, CB_SETCURSEL, 0, 0);
+ SendMessageA(combo, CB_SETCURSEL, 0, 0);
SetFocus(combo);
flush_sequence();
log_all_parent_messages++;
- SendMessage(combo, WM_KEYDOWN, VK_DOWN, 0);
- SendMessage(combo, WM_KEYUP, VK_DOWN, 0);
+ SendMessageA(combo, WM_KEYDOWN, VK_DOWN, 0);
+ SendMessageA(combo, WM_KEYUP, VK_DOWN, 0);
log_all_parent_messages--;
ok_sequence(WmKeyDownComboSeq, "WM_KEYDOWN/VK_DOWN on a ComboBox", FALSE);
flush_events();
flush_sequence();
- SendMessage(hwnd, WM_IME_KEYDOWN, VK_RETURN, 0x1c0001);
- SendMessage(hwnd, WM_CHAR, 'A', 1);
+ SendMessageA(hwnd, WM_IME_KEYDOWN, VK_RETURN, 0x1c0001);
+ SendMessageA(hwnd, WM_CHAR, 'A', 1);
ok_sequence(WmImeKeydownMsgSeq_0, "WM_IME_KEYDOWN 0", FALSE);
- while ( PeekMessage(&msg, 0, 0, 0, PM_REMOVE) )
+ while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmImeKeydownMsgSeq_1, "WM_IME_KEYDOWN 1", FALSE);
flush_sequence();
SetRectRgn( hrgn, -4, -4, -1, -1 );
RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | RDW_FRAME );
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ))
{
if (msg.hwnd == hwnd && msg.message == WM_PAINT)
{
ret = GetUpdateRect( hwnd, &rect, TRUE );
ok( !ret, "Invalid GetUpdateRect result %d\n", ret );
}
- DispatchMessage( &msg );
+ DispatchMessageA( &msg );
}
ok_sequence( WmGetUpdateRect, "GetUpdateRect", FALSE );
RedrawWindow( hparent, NULL, 0, RDW_ERASENOW | RDW_ALLCHILDREN );
ok_sequence( WmInvalidateParentChild2, "InvalidateParentChild2", FALSE );
- SetWindowLong( hparent, GWL_STYLE, GetWindowLong(hparent,GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hparent, GWL_STYLE, GetWindowLongA(hparent,GWL_STYLE) | WS_CLIPCHILDREN );
flush_sequence();
RedrawWindow( hparent, &rect, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN );
RedrawWindow( hparent, NULL, 0, RDW_ERASENOW );
/* flush all paint messages */
flush_events();
- SetWindowLong( hparent, GWL_STYLE, GetWindowLong(hparent,GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hparent, GWL_STYLE, GetWindowLongA(hparent,GWL_STYLE) & ~WS_CLIPCHILDREN );
flush_sequence();
/* RDW_UPDATENOW on child without WS_CLIPCHILDREN will validate corresponding parent area */
SetRectRgn( hrgn, 20, 20, 30, 30 );
check_update_rgn( hparent, hrgn );
/* no WM_PAINT in child while parent still pending */
- while (PeekMessage( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmEmptySeq, "No WM_PAINT", FALSE );
- while (PeekMessage( &msg, hparent, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, hparent, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmParentErasePaint, "WmParentErasePaint", FALSE );
flush_sequence();
RedrawWindow( hparent, &rect, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME );
/* no WM_PAINT in child while parent still pending */
- while (PeekMessage( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmEmptySeq, "No WM_PAINT", FALSE );
RedrawWindow( hparent, &rect, 0, RDW_VALIDATE | RDW_NOERASE | RDW_NOCHILDREN );
/* now that parent is valid child should get WM_PAINT */
- while (PeekMessage( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmInvalidateErasePaint2, "WmInvalidateErasePaint2", FALSE );
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmEmptySeq, "No other message", FALSE );
/* same thing with WS_CLIPCHILDREN in parent */
flush_sequence();
- SetWindowLong( hparent, GWL_STYLE, GetWindowLong(hparent,GWL_STYLE) | WS_CLIPCHILDREN );
+ SetWindowLongA( hparent, GWL_STYLE, GetWindowLongA(hparent,GWL_STYLE) | WS_CLIPCHILDREN );
ok_sequence( WmSetParentStyle, "WmSetParentStyle", FALSE );
/* changing style invalidates non client area, but we need to invalidate something else to see it */
RedrawWindow( hparent, &rect, 0, RDW_UPDATENOW );
SetRectRgn( hrgn, 20, 20, 30, 30 );
check_update_rgn( hparent, hrgn );
/* no WM_PAINT in child while parent still pending */
- while (PeekMessage( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, hchild, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmEmptySeq, "No WM_PAINT", FALSE );
/* WM_PAINT in parent first */
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence( WmParentPaintNc, "WmParentPaintNc2", FALSE );
/* no RDW_ERASE in parent still causes RDW_ERASE and RDW_FRAME in child */
flush_events();
ok_sequence( WmParentOnlyPaint, "WmParentOnlyPaint", FALSE );
- assert( GetWindowLong(hparent, GWL_STYLE) & WS_CLIPCHILDREN );
+ assert( GetWindowLongA(hparent, GWL_STYLE) & WS_CLIPCHILDREN );
UpdateWindow( hparent );
flush_events();
flush_sequence();
flush_events();
ok_sequence(WmSWP_FrameChangedDeferErase, "SetWindowPos:FrameChangedDeferErase", FALSE );
- SetWindowLong( hparent, GWL_STYLE, GetWindowLong(hparent,GWL_STYLE) & ~WS_CLIPCHILDREN );
+ SetWindowLongA( hparent, GWL_STYLE, GetWindowLongA(hparent,GWL_STYLE) & ~WS_CLIPCHILDREN );
ok_sequence( WmSetParentStyle, "WmSetParentStyle", FALSE );
RedrawWindow( hparent, NULL, 0, RDW_INTERNALPAINT );
flush_events();
ok_sequence( WmParentPaint, "WmParentPaint", FALSE );
- assert( !(GetWindowLong(hparent, GWL_STYLE) & WS_CLIPCHILDREN) );
+ assert( !(GetWindowLongA(hparent, GWL_STYLE) & WS_CLIPCHILDREN) );
UpdateWindow( hparent );
flush_events();
flush_sequence();
flush_events();
ok_sequence(WmSWP_FrameChangedDeferErase, "SetWindowPos:FrameChangedDeferErase", FALSE );
- ok(GetWindowLong( hparent, GWL_STYLE ) & WS_VISIBLE, "parent should be visible\n");
- ok(GetWindowLong( hchild, GWL_STYLE ) & WS_VISIBLE, "child should be visible\n");
+ ok(GetWindowLongA( hparent, GWL_STYLE ) & WS_VISIBLE, "parent should be visible\n");
+ ok(GetWindowLongA( hchild, GWL_STYLE ) & WS_VISIBLE, "child should be visible\n");
UpdateWindow( hparent );
flush_events();
SetEvent(wnd_event->start_event);
- while (GetMessage(&msg, 0, 0, 0))
+ while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok(IsWindow(wnd_event->hwnd), "window should still exist\n");
{
MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_ALLINPUT);
if (!IsWindow( hchild )) break; /* will be destroyed when parent thread exits */
- while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
}
return 0;
}
{
DWORD ret = MsgWaitForMultipleObjects(1, &child_event.start_event, FALSE, 1000, QS_SENDMESSAGE);
if (ret != 1) break;
- while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
}
ret = WaitForSingleObject( wnd_event->stop_event, 5000 );
ok( !ret, "WaitForSingleObject failed %x\n", ret );
return 0;
}
+static const char manifest_dep[] =
+"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
+"<assemblyIdentity version=\"1.2.3.4\" name=\"testdep1\" type=\"win32\" processorArchitecture=\"" ARCH "\"/>"
+" <file name=\"testdep.dll\" />"
+"</assembly>";
+
+static const char manifest_main[] =
+"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
+"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
+"<dependency>"
+" <dependentAssembly>"
+" <assemblyIdentity type=\"win32\" name=\"testdep1\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH "\" />"
+" </dependentAssembly>"
+"</dependency>"
+"</assembly>";
+
+static void create_manifest_file(const char *filename, const char *manifest)
+{
+ WCHAR path[MAX_PATH];
+ HANDLE file;
+ DWORD size;
+
+ MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
+ file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+ WriteFile(file, manifest, strlen(manifest), &size, NULL);
+ CloseHandle(file);
+}
+
+static HANDLE test_create(const char *file)
+{
+ WCHAR path[MAX_PATH];
+ ACTCTXW actctx;
+ HANDLE handle;
+
+ MultiByteToWideChar(CP_ACP, 0, file, -1, path, MAX_PATH);
+ memset(&actctx, 0, sizeof(ACTCTXW));
+ actctx.cbSize = sizeof(ACTCTXW);
+ actctx.lpSource = path;
+
+ handle = pCreateActCtxW(&actctx);
+ ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %u\n", GetLastError());
+
+ ok(actctx.cbSize == sizeof(actctx), "cbSize=%d\n", actctx.cbSize);
+ ok(actctx.dwFlags == 0, "dwFlags=%d\n", actctx.dwFlags);
+ ok(actctx.lpSource == path, "lpSource=%p\n", actctx.lpSource);
+ ok(actctx.wProcessorArchitecture == 0, "wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
+ ok(actctx.wLangId == 0, "wLangId=%d\n", actctx.wLangId);
+ ok(actctx.lpAssemblyDirectory == NULL, "lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
+ ok(actctx.lpResourceName == NULL, "lpResourceName=%p\n", actctx.lpResourceName);
+ ok(actctx.lpApplicationName == NULL, "lpApplicationName=%p\n", actctx.lpApplicationName);
+ ok(actctx.hModule == NULL, "hModule=%p\n", actctx.hModule);
+
+ return handle;
+}
+
static void test_interthread_messages(void)
{
- HANDLE hThread;
+ HANDLE hThread, context, handle, event;
+ ULONG_PTR cookie;
DWORD tid;
WNDPROC proc;
MSG msg;
wnd_event.hwnd = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 200, 200, 0, 0, 0, NULL);
ok (wnd_event.hwnd != 0, "Failed to create parent window\n");
+ flush_events();
flush_sequence();
log_all_parent_messages++;
wnd_event.start_event = CreateEventA( NULL, TRUE, FALSE, NULL );
{
ret = MsgWaitForMultipleObjects(1, &wnd_event.start_event, FALSE, 1000, QS_SENDMESSAGE);
if (ret != 1) break;
- while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
}
ok( !ret, "MsgWaitForMultipleObjects failed %x\n", ret );
/* now wait for the thread without processing messages; this shouldn't deadlock */
ok_sequence(WmExitThreadSeq, "destroy child on thread exit", FALSE);
log_all_parent_messages--;
DestroyWindow( wnd_event.hwnd );
+
+ /* activation context tests */
+ if (!pActivateActCtx)
+ {
+ win_skip("Activation contexts are not supported, skipping\n");
+ return;
+ }
+
+ create_manifest_file("testdep1.manifest", manifest_dep);
+ create_manifest_file("main.manifest", manifest_main);
+
+ context = test_create("main.manifest");
+ DeleteFileA("testdep1.manifest");
+ DeleteFileA("main.manifest");
+
+ handle = (void*)0xdeadbeef;
+ ret = pGetCurrentActCtx(&handle);
+ ok(ret, "GetCurentActCtx failed: %u\n", GetLastError());
+ ok(handle == 0, "active context %p\n", handle);
+
+ wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL);
+ hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
+ ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+ ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(wnd_event.start_event);
+
+ /* context is activated after thread creation, so it doesn't inherit it by default */
+ ret = pActivateActCtx(context, &cookie);
+ ok(ret, "activation failed: %u\n", GetLastError());
+
+ handle = 0;
+ ret = pGetCurrentActCtx(&handle);
+ ok(ret, "GetCurentActCtx failed: %u\n", GetLastError());
+ ok(handle != 0, "active context %p\n", handle);
+
+ /* destination window will test for active context */
+ ret = SendMessageA(wnd_event.hwnd, WM_USER+10, 0, 0);
+ ok(ret, "thread window returned %d\n", ret);
+
+ event = CreateEventW(NULL, 0, 0, NULL);
+ ret = PostMessageA(wnd_event.hwnd, WM_USER+10, 0, (LPARAM)event);
+ ok(ret, "thread window returned %d\n", ret);
+ ok(WaitForSingleObject(event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(event);
+
+ ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
+ ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+
+ ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+ CloseHandle(hThread);
+
+ ret = pDeactivateActCtx(0, cookie);
+ ok(ret, "DeactivateActCtx failed: %u\n", GetLastError());
+ pReleaseActCtx(context);
}
log_msg.descr = "accel";
add_message(&log_msg);
- if (!hAccel || !TranslateAccelerator(hwnd, hAccel, &msg))
+ if (!hAccel || !TranslateAcceleratorA(hwnd, hAccel, &msg))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
}
}
state = GetKeyState(VK_CAPITAL);
ok(state == 0, "wrong CapsLock state %04x\n", state);
- hAccel = LoadAccelerators(GetModuleHandleA(0), MAKEINTRESOURCE(1));
+ hAccel = LoadAcceleratorsA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(1));
assert(hAccel != 0);
flush_events();
ret = DestroyAcceleratorTable(hAccel);
ok( ret, "DestroyAcceleratorTable error %d\n", GetLastError());
- hAccel = LoadAccelerators(GetModuleHandleA(0), MAKEINTRESOURCE(2));
+ hAccel = LoadAcceleratorsA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(2));
assert(hAccel != 0);
trace("testing VK_N press/release\n");
case WM_NCHITTEST:
return HTCLIENT;
+ case WM_USER+10:
+ {
+ HANDLE handle, event = (HANDLE)lParam;
+ BOOL ret;
+
+ handle = (void*)0xdeadbeef;
+ ret = pGetCurrentActCtx(&handle);
+ ok(ret, "failed to get current context, %u\n", GetLastError());
+ ok(handle == 0, "got active context %p\n", handle);
+ if (event) SetEvent(event);
+ return 1;
+ }
+
/* ignore */
case WM_MOUSEMOVE:
case WM_MOUSEACTIVATE:
static INT_PTR CALLBACK StopQuitMsgCheckProcA(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
{
if (message == WM_CREATE)
- PostMessage(hwnd, WM_CLOSE, 0, 0);
+ PostMessageA(hwnd, WM_CLOSE, 0, 0);
else if (message == WM_CLOSE)
{
/* Only the first WM_QUIT will survive the window destruction */
- PostMessage(hwnd, WM_USER, 0x1234, 0x5678);
- PostMessage(hwnd, WM_QUIT, 0x1234, 0x5678);
- PostMessage(hwnd, WM_QUIT, 0x4321, 0x8765);
+ PostMessageA(hwnd, WM_USER, 0x1234, 0x5678);
+ PostMessageA(hwnd, WM_QUIT, 0x1234, 0x5678);
+ PostMessageA(hwnd, WM_QUIT, 0x4321, 0x8765);
}
return DefWindowProcA(hwnd, message, wp, lp);
if (PeekMessageA(&msg2, 0, 0, 0, 1))
{
TranslateMessage(&msg2);
- DispatchMessage(&msg2);
+ DispatchMessageA(&msg2);
}
i--;
}
else ok(broken(1), "infinite loop\n");
if ( i == 0)
- paint_loop_done = 1;
+ paint_loop_done = TRUE;
return DefWindowProcA(hWnd,msg,wParam,lParam);
}
}
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 = "TestWindowClass";
{
}
-#define TIMER_ID 0x19
+#define TIMER_ID 0x19
+#define TIMER_COUNT_EXPECTED 64
+#define TIMER_COUNT_TOLERANCE 9
+
+static int count = 0;
+static void CALLBACK callback_count(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+{
+ count++;
+}
static DWORD WINAPI timer_thread_proc(LPVOID x)
{
static void test_timers(void)
{
struct timer_info info;
+ DWORD start;
DWORD id;
+ MSG msg;
- info.hWnd = CreateWindow ("TestWindowClass", NULL,
+ info.hWnd = CreateWindowA("TestWindowClass", NULL,
WS_OVERLAPPEDWINDOW ,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
NULL, NULL, 0);
info.id = SetTimer(info.hWnd,TIMER_ID,10000,tfunc);
ok(info.id, "SetTimer failed\n");
ok(info.id==TIMER_ID, "SetTimer timer ID different\n");
- info.handles[0] = CreateEvent(NULL,0,0,NULL);
+ info.handles[0] = CreateEventW(NULL,0,0,NULL);
info.handles[1] = CreateThread(NULL,0,timer_thread_proc,&info,0,&id);
WaitForMultipleObjects(2, info.handles, FALSE, INFINITE);
ok( KillTimer(info.hWnd, TIMER_ID), "KillTimer failed\n");
- ok(DestroyWindow(info.hWnd), "failed to destroy window\n");
-}
+ /* Check the minimum allowed timeout for a timer. MSDN indicates that it should be 10.0 ms,
+ * but testing indicates that the minimum timeout is actually about 15.6 ms. Since there is
+ * some measurement error between test runs we're allowing for ±8 counts (~2 ms).
+ */
+ count = 0;
+ id = SetTimer(info.hWnd, TIMER_ID, 0, callback_count);
+ ok(id != 0, "did not get id from SetTimer.\n");
+ ok(id==TIMER_ID, "SetTimer timer ID different\n");
+ start = GetTickCount();
+ while (GetTickCount()-start < 1001 && GetMessageA(&msg, info.hWnd, 0, 0))
+ DispatchMessageA(&msg);
+ ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE
+ || broken(abs(count-43) < TIMER_COUNT_TOLERANCE) /* w2k3 */,
+ "did not get expected count for minimum timeout (%d != ~%d).\n",
+ count, TIMER_COUNT_EXPECTED);
+ ok(KillTimer(info.hWnd, id), "KillTimer failed\n");
+ /* Perform the same check on SetSystemTimer (only available on w2k3 and older) */
+ if (pSetSystemTimer)
+ {
+ int syscount = 0;
+
+ count = 0;
+ id = pSetSystemTimer(info.hWnd, TIMER_ID, 0, callback_count);
+ ok(id != 0, "did not get id from SetSystemTimer.\n");
+ ok(id==TIMER_ID, "SetTimer timer ID different\n");
+ start = GetTickCount();
+ while (GetTickCount()-start < 1001 && GetMessageA(&msg, info.hWnd, 0, 0))
+ {
+ if (msg.message == WM_SYSTIMER)
+ syscount++;
+ DispatchMessageA(&msg);
+ }
+ ok(abs(syscount-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE,
+ "did not get expected count for minimum timeout (%d != ~%d).\n",
+ syscount, TIMER_COUNT_EXPECTED);
+ todo_wine ok(count == 0, "did not get expected count for callback timeout (%d != 0).\n",
+ count);
+ ok(pKillSystemTimer(info.hWnd, id), "KillSystemTimer failed\n");
+ }
-static int count = 0;
-static VOID CALLBACK callback_count(
- HWND hwnd,
- UINT uMsg,
- UINT_PTR idEvent,
- DWORD dwTime
-)
-{
- count++;
+ ok(DestroyWindow(info.hWnd), "failed to destroy window\n");
}
static void test_timers_no_wnd(void)
{
UINT_PTR id, id2;
+ DWORD start;
MSG msg;
count = 0;
id2 = SetTimer(NULL, id, 200, callback_count);
ok(id2 == id, "did not get same id from SetTimer when replacing (%li expected %li).\n", id2, id);
Sleep(150);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(count == 0, "did not get zero count as expected (%i).\n", count);
Sleep(150);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(count == 1, "did not get one count as expected (%i).\n", count);
KillTimer(NULL, id);
Sleep(250);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(count == 1, "killing replaced timer did not work (%i).\n", count);
+
+ /* Check the minimum allowed timeout for a timer. MSDN indicates that it should be 10.0 ms,
+ * but testing indicates that the minimum timeout is actually about 15.6 ms. Since there is
+ * some measurement error between test runs we're allowing for ±8 counts (~2 ms).
+ */
+ count = 0;
+ id = SetTimer(NULL, 0, 0, callback_count);
+ ok(id != 0, "did not get id from SetTimer.\n");
+ start = GetTickCount();
+ while (GetTickCount()-start < 1001 && GetMessageA(&msg, NULL, 0, 0))
+ DispatchMessageA(&msg);
+ ok(abs(count-TIMER_COUNT_EXPECTED) < TIMER_COUNT_TOLERANCE,
+ "did not get expected count for minimum timeout (%d != ~%d).\n",
+ count, TIMER_COUNT_EXPECTED);
+ KillTimer(NULL, id);
+ /* Note: SetSystemTimer doesn't support a NULL window, see test_timers */
}
/* Various win events with arbitrary parameters */
pNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, hwnd, OBJID_ALERT, 0);
SetEvent(hevent);
- while (GetMessage(&msg, 0, 0, 0))
+ while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
return 0;
}
SetEvent(hevent);
- while (GetMessage(&msg, 0, 0, 0))
+ while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
return 0;
}
mouse_event(MOUSEEVENTF_MOVE, 1, 0, 0, 0);
SetEvent(hevent);
- while (GetMessage(&msg, 0, 0, 0))
+ while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
return 0;
}
ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
while (WaitForSingleObject(hevent, 100) == WAIT_TIMEOUT)
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
ok_sequence(WmMouseLLHookSeq, "MOUSE_LL hook other thread", FALSE);
flush_sequence();
trace("start scroll\n");
ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL,
SW_ERASE|SW_INVALIDATE);
- ok_sequence(WmEmptySeq, "ScrollWindowEx", 0);
+ ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE);
trace("end scroll\n");
flush_sequence();
flush_events();
- ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0);
+ ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE);
flush_events();
flush_sequence();
/* Now without the SW_ERASE flag */
trace("start scroll\n");
ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL, SW_INVALIDATE);
- ok_sequence(WmEmptySeq, "ScrollWindowEx", 0);
+ ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE);
trace("end scroll\n");
flush_sequence();
flush_events();
- ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", 0);
+ ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", FALSE);
flush_events();
flush_sequence();
trace("end scroll\n");
flush_sequence();
flush_events();
- ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0);
+ ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE);
flush_events();
flush_sequence();
trace("end scroll\n");
flush_sequence();
flush_events();
- ok_sequence(ScrollWindowPaint1, "ScrollWindow", 0);
+ ok_sequence(ScrollWindowPaint1, "ScrollWindow", FALSE);
ok(DestroyWindow(hchild), "failed to destroy window\n");
ok(DestroyWindow(hwnd), "failed to destroy window\n");
ret = DestroyWindow(parent);
ok( ret, "DestroyWindow() error %d\n", GetLastError());
test_DestroyWindow_flag = FALSE;
- ok_sequence(destroy_window_with_children, "destroy window with children", 0);
+ ok_sequence(destroy_window_with_children, "destroy window with children", FALSE);
ok(!IsWindow(parent), "parent still exists\n");
ok(!IsWindow(child1), "child1 still exists\n");
SetRect( &rect, -5, -5, 5, 5 );
RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE|RDW_ERASE|RDW_FRAME );
count = 0;
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ))
{
- if (msg.message != WM_PAINT) DispatchMessage( &msg );
+ if (msg.message != WM_PAINT) DispatchMessageA( &msg );
else
{
flush_sequence();
- DispatchMessage( &msg );
+ DispatchMessageA( &msg );
/* DispatchMessage will send WM_NCPAINT if non client area is still invalid after WM_PAINT */
if (!count) ok_sequence( WmDispatchPaint, "WmDispatchPaint", FALSE );
else ok_sequence( WmEmptySeq, "WmEmpty", FALSE );
flush_sequence();
RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE|RDW_ERASE|RDW_FRAME );
count = 0;
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ))
{
- if (msg.message != WM_PAINT) DispatchMessage( &msg );
+ if (msg.message != WM_PAINT) DispatchMessageA( &msg );
else
{
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
if (++count > 10) break;
}
}
+
+ flush_sequence();
+ RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE|RDW_ERASE|RDW_FRAME );
+ count = 0;
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ))
+ {
+ if (msg.message != WM_PAINT) DispatchMessageA( &msg );
+ else
+ {
+ HDC hdc;
+
+ flush_sequence();
+ hdc = BeginPaint( hwnd, NULL );
+ ok( !hdc, "got valid hdc %p from BeginPaint\n", hdc );
+ ok( !EndPaint( hwnd, NULL ), "EndPaint succeeded\n" );
+ ok_sequence( WmDispatchPaint, "WmDispatchPaint", FALSE );
+ ok( !count, "Got multiple WM_PAINTs\n" );
+ if (++count > 10) break;
+ }
+ }
DestroyWindow(hwnd);
}
while (MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_SENDMESSAGE) != WAIT_OBJECT_0)
{
MSG msg;
- while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage(&msg);
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA(&msg);
}
}
{ WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) },
{ 0 }
};
+static const struct message sl_edit_invisible[] =
+{
+ { HCBT_SETFOCUS, hook },
+ { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
+ { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
+ { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
+ { WM_KILLFOCUS, sent|parent },
+ { WM_SETFOCUS, sent },
+ { WM_COMMAND, sent|parent|wparam, MAKEWPARAM(ID_EDIT, EN_SETFOCUS) },
+ { 0 }
+};
static const struct message ml_edit_setfocus[] =
{
{ HCBT_SETFOCUS, hook },
old_edit_proc = cls.lpfnWndProc;
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
cls.lpfnWndProc = edit_hook_proc;
cls.lpszClassName = "my_edit_class";
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
if (!RegisterClassA(&cls)) assert(0);
}
dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS), "wrong dlg_code %08x\n", dlg_code);
+ flush_sequence();
+ SetFocus(hwnd);
+ ok_sequence(sl_edit_invisible, "SetFocus(hwnd) on an invisible edit", FALSE);
+
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
SetFocus(0);
}
if (qstatus & QS_POSTMESSAGE)
{
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) /* nothing */ ;
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) /* nothing */ ;
qstatus = GetQueueStatus(qs_all_input);
}
ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
{
MSG msg;
DWORD time;
- BOOL ret;
- int go = 0;
+ BOOL ret, go = FALSE;
time = GetTickCount();
while (GetTickCount() - time < 200 && !go) {
x1 = y1 = x2 = y2 = x3 = y3 = 0;
/* Initialise window and make sure it is ready for events */
- hwnd = CreateWindow("TestWindowClass", "PeekMessage2", WS_OVERLAPPEDWINDOW,
+ hwnd = CreateWindowA("TestWindowClass", "PeekMessage2", WS_OVERLAPPEDWINDOW,
10, 10, 800, 800, NULL, NULL, NULL, NULL);
assert(hwnd);
trace("Window for test_PeekMessage2 %p\n", hwnd);
switch (message)
{
case WM_INITDIALOG:
- PostMessage(hwnd, WM_QUIT, 0x1234, 0x5678);
- PostMessage(hwnd, WM_USER, 0xdead, 0xbeef);
+ PostMessageA(hwnd, WM_QUIT, 0x1234, 0x5678);
+ PostMessageA(hwnd, WM_USER, 0xdead, 0xbeef);
return 0;
case WM_GETDLGCODE:
flush_events();
PostQuitMessage(0xbeef);
- ret = PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
+ ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
ok(ret, "PeekMessage failed with error %d\n", GetLastError());
ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
ok(msg.wParam == 0xbeef, "wParam was 0x%lx instead of 0xbeef\n", msg.wParam);
- ret = PostThreadMessage(GetCurrentThreadId(), WM_USER, 0, 0);
+ ret = PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
ok(ret, "PostMessage failed with error %d\n", GetLastError());
- ret = GetMessage(&msg, NULL, 0, 0);
+ ret = GetMessageA(&msg, NULL, 0, 0);
ok(ret > 0, "GetMessage failed with error %d\n", GetLastError());
ok(msg.message == WM_USER, "Received message 0x%04x instead of WM_USER\n", msg.message);
/* note: WM_QUIT message received after WM_USER message */
- ret = GetMessage(&msg, NULL, 0, 0);
+ ret = GetMessageA(&msg, NULL, 0, 0);
ok(!ret, "GetMessage return %d with error %d instead of FALSE\n", ret, GetLastError());
ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
ok(msg.wParam == 0xbeef, "wParam was 0x%lx instead of 0xbeef\n", msg.wParam);
- ret = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
+ ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE);
ok( !ret || msg.message != WM_QUIT, "Received WM_QUIT again\n" );
/* now test with PostThreadMessage - different behaviour! */
- PostThreadMessage(GetCurrentThreadId(), WM_QUIT, 0xdead, 0);
+ PostThreadMessageA(GetCurrentThreadId(), WM_QUIT, 0xdead, 0);
- ret = PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
+ ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
ok(ret, "PeekMessage failed with error %d\n", GetLastError());
ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
ok(msg.wParam == 0xdead, "wParam was 0x%lx instead of 0xdead\n", msg.wParam);
- ret = PostThreadMessage(GetCurrentThreadId(), WM_USER, 0, 0);
+ ret = PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
ok(ret, "PostMessage failed with error %d\n", GetLastError());
/* note: we receive the WM_QUIT message first this time */
- ret = GetMessage(&msg, NULL, 0, 0);
+ ret = GetMessageA(&msg, NULL, 0, 0);
ok(!ret, "GetMessage return %d with error %d instead of FALSE\n", ret, GetLastError());
ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
ok(msg.wParam == 0xdead, "wParam was 0x%lx instead of 0xdead\n", msg.wParam);
- ret = GetMessage(&msg, NULL, 0, 0);
+ ret = GetMessageA(&msg, NULL, 0, 0);
ok(ret > 0, "GetMessage failed with error %d\n", GetLastError());
ok(msg.message == WM_USER, "Received message 0x%04x instead of WM_USER\n", msg.message);
flush_events();
flush_sequence();
- ret = DialogBoxParam(GetModuleHandle(0), "TEST_EMPTY_DIALOG", 0, wm_quit_dlg_proc, 0);
+ ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, wm_quit_dlg_proc, 0);
ok(ret == 1, "expected 1, got %d\n", ret);
ok_sequence(WmQuitDialogSeq, "WmQuitDialogSeq", FALSE);
memset(&msg, 0xab, sizeof(msg));
- ret = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
+ ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE);
ok(ret, "PeekMessage failed\n");
ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
ok(msg.wParam == 0x1234, "wParam was 0x%lx instead of 0x1234\n", msg.wParam);
CreateWindowExA(0, "StopQuitClass", "Stop Quit Test", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, NULL, NULL, NULL, NULL);
flush_sequence();
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
struct recvd_message rmsg;
rmsg.hwnd = msg.hwnd;
/* The hwnd can only be checked here */
ok(!msg.hwnd, "The WM_QUIT hwnd was %p instead of NULL\n", msg.hwnd);
add_message(&rmsg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmStopQuitSeq, "WmStopQuitSeq", FALSE);
}
do
{
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
/* Timer proc messages are not dispatched to the window proc,
* and therefore not logged.
s_msg.descr = "msg_loop";
add_message(&s_msg);
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
end_ticks = GetTickCount();
default_hover_time = 0xdeadbeef;
SetLastError(0xdeadbeef);
- ret = SystemParametersInfo(SPI_GETMOUSEHOVERTIME, 0, &default_hover_time, 0);
+ ret = SystemParametersInfoA(SPI_GETMOUSEHOVERTIME, 0, &default_hover_time, 0);
ok(ret || broken(GetLastError() == 0xdeadbeef), /* win9x */
"SystemParametersInfo(SPI_GETMOUSEHOVERTIME) error %u\n", GetLastError());
if (!ret) default_hover_time = 400;
trace("SPI_GETMOUSEHOVERTIME returned %u ms\n", default_hover_time);
SetLastError(0xdeadbeef);
- ret = SystemParametersInfo(SPI_GETMOUSEHOVERWIDTH, 0, &hover_width, 0);
+ ret = SystemParametersInfoA(SPI_GETMOUSEHOVERWIDTH, 0, &hover_width, 0);
ok(ret || broken(GetLastError() == 0xdeadbeef), /* win9x */
"SystemParametersInfo(SPI_GETMOUSEHOVERWIDTH) error %u\n", GetLastError());
if (!ret) hover_width = 4;
SetLastError(0xdeadbeef);
- ret = SystemParametersInfo(SPI_GETMOUSEHOVERHEIGHT, 0, &hover_height, 0);
+ ret = SystemParametersInfoA(SPI_GETMOUSEHOVERHEIGHT, 0, &hover_height, 0);
ok(ret || broken(GetLastError() == 0xdeadbeef), /* win9x */
"SystemParametersInfo(SPI_GETMOUSEHOVERHEIGHT) error %u\n", GetLastError());
if (!ret) hover_height = 4;
trace("hover rect is %u x %d\n", hover_width, hover_height);
- hwnd = CreateWindowEx(0, "TestWindowClass", NULL,
+ hwnd = CreateWindowExA(0, "TestWindowClass", NULL,
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
NULL, NULL, 0);
assert(hwnd);
- hchild = CreateWindowEx(0, "TestWindowClass", NULL,
+ hchild = CreateWindowExA(0, "TestWindowClass", NULL,
WS_CHILD | WS_BORDER | WS_VISIBLE,
50, 50, 200, 200, hwnd,
NULL, NULL, 0);
RECT win_rc, work_rc = {0, 0, 0, 0};
#define WS_BASE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_POPUP|WS_CLIPSIBLINGS)
- hwnd = CreateWindowEx(0, "ShowWindowClass", NULL, WS_BASE,
+ hwnd = CreateWindowExA(0, "ShowWindowClass", NULL, WS_BASE,
120, 120, 90, 90,
0, 0, 0, NULL);
assert(hwnd);
- style = GetWindowLong(hwnd, GWL_STYLE) & ~WS_BASE;
+ style = GetWindowLongA(hwnd, GWL_STYLE) & ~WS_BASE;
ok(style == 0, "expected style 0, got %08x\n", style);
flush_events();
idx = (sw[i].cmd == SW_NORMALNA) ? 12 : sw[i].cmd;
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongA(hwnd, GWL_STYLE);
trace("%d: sending %s, current window style %08x\n", i+1, sw_cmd_name[idx], style);
ret = ShowWindow(hwnd, sw[i].cmd);
ok(!ret == !sw[i].ret, "%d: cmd %s: expected ret %lu, got %lu\n", i+1, sw_cmd_name[idx], sw[i].ret, ret);
- style = GetWindowLong(hwnd, GWL_STYLE) & ~WS_BASE;
+ style = GetWindowLongA(hwnd, GWL_STYLE) & ~WS_BASE;
ok(style == sw[i].style, "%d: expected style %08x, got %08x\n", i+1, sw[i].style, style);
sprintf(comment, "%d: ShowWindow(%s)", i+1, sw_cmd_name[idx]);
}
else
{
- if (wp.ptMinPosition.x != sw[i].wp_min.x || wp.ptMinPosition.y != sw[i].wp_min.y)
- todo_wine
- ok(wp.ptMinPosition.x == sw[i].wp_min.x && wp.ptMinPosition.y == sw[i].wp_min.y,
- "expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
- else
ok(wp.ptMinPosition.x == sw[i].wp_min.x && wp.ptMinPosition.y == sw[i].wp_min.y,
"expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
}
static void test_dialog_messages(void)
{
- WNDCLASS cls;
+ WNDCLASSA cls;
HWND hdlg, hedit1, hedit2, hfocus;
LRESULT ret;
#define set_selection(hctl, start, end) \
- ret = SendMessage(hctl, EM_SETSEL, start, end); \
+ ret = SendMessageA(hctl, EM_SETSEL, start, end); \
ok(ret == 1, "EM_SETSEL returned %ld\n", ret);
#define check_selection(hctl, start, end) \
- ret = SendMessage(hctl, EM_GETSEL, 0, 0); \
+ ret = SendMessageA(hctl, EM_GETSEL, 0, 0); \
ok(ret == MAKELRESULT(start, end), "wrong selection (%d - %d)\n", LOWORD(ret), HIWORD(ret));
subclass_edit();
- hdlg = CreateWindowEx(WS_EX_DLGMODALFRAME, "TestDialogClass", NULL,
+ hdlg = CreateWindowExA(WS_EX_DLGMODALFRAME, "TestDialogClass", NULL,
WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_DLGFRAME,
0, 0, 100, 100, 0, 0, 0, NULL);
ok(hdlg != 0, "Failed to create custom dialog window\n");
- hedit1 = CreateWindowEx(0, "my_edit_class", NULL,
+ hedit1 = CreateWindowExA(0, "my_edit_class", NULL,
WS_CHILD|WS_BORDER|WS_VISIBLE|WS_TABSTOP,
0, 0, 80, 20, hdlg, (HMENU)1, 0, NULL);
ok(hedit1 != 0, "Failed to create edit control\n");
- hedit2 = CreateWindowEx(0, "my_edit_class", NULL,
+ hedit2 = CreateWindowExA(0, "my_edit_class", NULL,
WS_CHILD|WS_BORDER|WS_VISIBLE|WS_TABSTOP,
0, 40, 80, 20, hdlg, (HMENU)2, 0, NULL);
ok(hedit2 != 0, "Failed to create edit control\n");
- SendMessage(hedit1, WM_SETTEXT, 0, (LPARAM)"hello");
- SendMessage(hedit2, WM_SETTEXT, 0, (LPARAM)"bye");
+ SendMessageA(hedit1, WM_SETTEXT, 0, (LPARAM)"hello");
+ SendMessageA(hedit2, WM_SETTEXT, 0, (LPARAM)"bye");
hfocus = GetFocus();
ok(hfocus == hdlg, "wrong focus %p\n", hfocus);
ok(hfocus == 0, "wrong focus %p\n", hfocus);
flush_sequence();
- ret = DefDlgProc(hdlg, WM_SETFOCUS, 0, 0);
+ ret = DefDlgProcA(hdlg, WM_SETFOCUS, 0, 0);
ok(ret == 0, "WM_SETFOCUS returned %ld\n", ret);
ok_sequence(WmDefDlgSetFocus_1, "DefDlgProc(WM_SETFOCUS) 1", FALSE);
check_selection(hedit2, 0, 3);
flush_sequence();
- ret = DefDlgProc(hdlg, WM_SETFOCUS, 0, 0);
+ ret = DefDlgProcA(hdlg, WM_SETFOCUS, 0, 0);
ok(ret == 0, "WM_SETFOCUS returned %ld\n", ret);
ok_sequence(WmDefDlgSetFocus_2, "DefDlgProc(WM_SETFOCUS) 2", FALSE);
#undef set_selection
#undef check_selection
- ok(GetClassInfo(0, "#32770", &cls), "GetClassInfo failed\n");
+ ok(GetClassInfoA(0, "#32770", &cls), "GetClassInfo failed\n");
cls.lpszClassName = "MyDialogClass";
- cls.hInstance = GetModuleHandle(0);
+ cls.hInstance = GetModuleHandleA(NULL);
/* need a cast since a dlgproc is used as a wndproc */
cls.lpfnWndProc = test_dlg_proc;
- if (!RegisterClass(&cls)) assert(0);
+ if (!RegisterClassA(&cls)) assert(0);
- hdlg = CreateDialogParam(0, "CLASS_TEST_DIALOG_2", 0, test_dlg_proc, 0);
+ hdlg = CreateDialogParamA(0, "CLASS_TEST_DIALOG_2", 0, test_dlg_proc, 0);
ok(IsWindow(hdlg), "CreateDialogParam failed\n");
ok_sequence(WmCreateDialogParamSeq_1, "CreateDialogParam_1", FALSE);
EndDialog(hdlg, 0);
DestroyWindow(hdlg);
flush_sequence();
- hdlg = CreateDialogParam(0, "CLASS_TEST_DIALOG_2", 0, NULL, 0);
+ hdlg = CreateDialogParamA(0, "CLASS_TEST_DIALOG_2", 0, NULL, 0);
ok(IsWindow(hdlg), "CreateDialogParam failed\n");
ok_sequence(WmCreateDialogParamSeq_2, "CreateDialogParam_2", FALSE);
EndDialog(hdlg, 0);
DestroyWindow(hdlg);
flush_sequence();
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
}
static void test_EndDialog(void)
{
HWND hparent, hother, hactive, hdlg;
- WNDCLASS cls;
+ WNDCLASSA cls;
hparent = CreateWindowExA(0, "TestParentClass", "Test parent",
WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_DISABLED,
100, 100, 200, 200, 0, 0, 0, NULL);
ok (hother != 0, "Failed to create parent window\n");
- ok(GetClassInfo(0, "#32770", &cls), "GetClassInfo failed\n");
+ ok(GetClassInfoA(0, "#32770", &cls), "GetClassInfo failed\n");
cls.lpszClassName = "MyDialogClass";
- cls.hInstance = GetModuleHandle(0);
- /* need a cast since a dlgproc is used as a wndproc */
- cls.lpfnWndProc = (WNDPROC)test_dlg_proc;
- if (!RegisterClass(&cls)) assert(0);
+ cls.hInstance = GetModuleHandleA(NULL);
+ cls.lpfnWndProc = test_dlg_proc;
+ if (!RegisterClassA(&cls)) assert(0);
flush_sequence();
SetForegroundWindow(hother);
/* create a dialog where the parent is disabled, this parent should still
receive the focus when the dialog exits (even though "normally" a
disabled window should not receive the focus) */
- hdlg = CreateDialogParam(0, "CLASS_TEST_DIALOG_2", hparent, test_dlg_proc, 0);
+ hdlg = CreateDialogParamA(0, "CLASS_TEST_DIALOG_2", hparent, test_dlg_proc, 0);
ok(IsWindow(hdlg), "CreateDialogParam failed\n");
SetForegroundWindow(hdlg);
hactive = GetForegroundWindow();
DestroyWindow( hother );
DestroyWindow( hparent );
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
}
static void test_nullCallback(void)
DestroyWindow(hwnd2);
}
+static void test_unicode_wm_char(void)
+{
+ HWND hwnd;
+ MSG msg;
+ struct message seq[2];
+ HKL hkl_orig, hkl_greek;
+ DWORD cp;
+ LCID thread_locale;
+
+ hkl_orig = GetKeyboardLayout( 0 );
+ GetLocaleInfoW( LOWORD( hkl_orig ), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR*)&cp, sizeof(cp) / sizeof(WCHAR) );
+ if (cp != 1252)
+ {
+ skip( "Default codepage %d\n", cp );
+ return;
+ }
+
+ hkl_greek = LoadKeyboardLayoutA( "00000408", 0 );
+ if (!hkl_greek || hkl_greek == hkl_orig /* win2k */)
+ {
+ skip( "Unable to load Greek keyboard layout\n" );
+ return;
+ }
+
+ hwnd = CreateWindowExW( 0, testWindowClassW, NULL, WS_OVERLAPPEDWINDOW,
+ 100, 100, 200, 200, 0, 0, 0, NULL );
+ flush_sequence();
+
+ PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 );
+
+ ok( GetMessageW( &msg, hwnd, 0, 0 ), "no message\n" );
+ 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 );
+ ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+
+ DispatchMessageW( &msg );
+
+ memset( seq, 0, sizeof(seq) );
+ seq[0].message = WM_CHAR;
+ seq[0].flags = sent|wparam;
+ seq[0].wParam = 0x3b1;
+
+ ok_sequence( seq, "unicode WM_CHAR", FALSE );
+
+ flush_sequence();
+
+ /* greek alpha -> 'a' in cp1252 */
+ PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 );
+
+ ok( GetMessageA( &msg, hwnd, 0, 0 ), "no message\n" );
+ ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
+ ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
+ ok( msg.wParam == 0x61, "bad wparam %lx\n", msg.wParam );
+ ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+
+ DispatchMessageA( &msg );
+
+ seq[0].wParam = 0x61;
+ ok_sequence( seq, "unicode WM_CHAR", FALSE );
+
+ thread_locale = GetThreadLocale();
+ ActivateKeyboardLayout( hkl_greek, 0 );
+ ok( GetThreadLocale() == thread_locale, "locale changed from %08x to %08x\n",
+ thread_locale, GetThreadLocale() );
+
+ flush_sequence();
+
+ /* greek alpha -> 0xe1 in cp1253 */
+ PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 );
+
+ ok( GetMessageA( &msg, hwnd, 0, 0 ), "no message\n" );
+ ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
+ ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
+ ok( msg.wParam == 0xe1, "bad wparam %lx\n", msg.wParam );
+ ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+
+ DispatchMessageA( &msg );
+
+ seq[0].wParam = 0x3b1;
+ ok_sequence( seq, "unicode WM_CHAR", FALSE );
+
+ DestroyWindow( hwnd );
+ ActivateKeyboardLayout( hkl_orig, 0 );
+ UnloadKeyboardLayout( hkl_greek );
+}
+
#define ID_LISTBOX 0x000f
static const struct message wm_lb_setcursel_0[] =
check_lb_state(listbox, 0, LB_ERR, 0, 0);
- ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
ok(ret == 0, "expected 0, got %ld\n", ret);
- ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
ok(ret == 1, "expected 1, got %ld\n", ret);
- ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
+ ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
ok(ret == 2, "expected 2, got %ld\n", ret);
check_lb_state(listbox, 3, LB_ERR, 0, 0);
log_all_parent_messages++;
trace("selecting item 0\n");
- ret = SendMessage(listbox, LB_SETCURSEL, 0, 0);
+ ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
ok(ret == 0, "expected 0, got %ld\n", ret);
ok_sequence(wm_lb_setcursel_0, "LB_SETCURSEL 0", FALSE );
check_lb_state(listbox, 3, 0, 0, 0);
flush_sequence();
trace("selecting item 1\n");
- ret = SendMessage(listbox, LB_SETCURSEL, 1, 0);
+ ret = SendMessageA(listbox, LB_SETCURSEL, 1, 0);
ok(ret == 1, "expected 1, got %ld\n", ret);
ok_sequence(wm_lb_setcursel_1, "LB_SETCURSEL 1", FALSE );
check_lb_state(listbox, 3, 1, 1, 0);
trace("selecting item 2\n");
- ret = SendMessage(listbox, LB_SETCURSEL, 2, 0);
+ ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
ok(ret == 2, "expected 2, got %ld\n", ret);
ok_sequence(wm_lb_setcursel_2, "LB_SETCURSEL 2", FALSE );
check_lb_state(listbox, 3, 2, 2, 0);
trace("clicking on item 0\n");
- ret = SendMessage(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(1, 1));
+ ret = SendMessageA(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(1, 1));
ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret);
- ret = SendMessage(listbox, WM_LBUTTONUP, 0, 0);
+ ret = SendMessageA(listbox, WM_LBUTTONUP, 0, 0);
ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret);
ok_sequence(wm_lb_click_0, "WM_LBUTTONDOWN 0", FALSE );
check_lb_state(listbox, 3, 0, 0, 0);
flush_sequence();
trace("deleting item 0\n");
- ret = SendMessage(listbox, LB_DELETESTRING, 0, 0);
+ ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
ok(ret == 2, "expected 2, got %ld\n", ret);
ok_sequence(wm_lb_deletestring, "LB_DELETESTRING 0", FALSE );
check_lb_state(listbox, 2, -1, 0, 0);
flush_sequence();
trace("deleting item 0\n");
- ret = SendMessage(listbox, LB_DELETESTRING, 0, 0);
+ ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
ok(ret == 1, "expected 1, got %ld\n", ret);
ok_sequence(wm_lb_deletestring, "LB_DELETESTRING 0", FALSE );
check_lb_state(listbox, 1, -1, 0, 0);
flush_sequence();
trace("deleting item 0\n");
- ret = SendMessage(listbox, LB_DELETESTRING, 0, 0);
+ ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
ok(ret == 0, "expected 0, got %ld\n", ret);
ok_sequence(wm_lb_deletestring_reset, "LB_DELETESTRING 0", FALSE );
check_lb_state(listbox, 0, -1, 0, 0);
flush_sequence();
trace("deleting item 0\n");
- ret = SendMessage(listbox, LB_DELETESTRING, 0, 0);
+ ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
ok(ret == LB_ERR, "expected LB_ERR, got %ld\n", ret);
check_lb_state(listbox, 0, -1, 0, 0);
flush_sequence();
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 = "TestMenuClass";
- UnregisterClass(cls.lpszClassName, cls.hInstance);
+ UnregisterClassA(cls.lpszClassName, cls.hInstance);
if (!RegisterClassA(&cls)) assert(0);
SetLastError(0xdeadbeef);
ok(hwnd != 0, "LoadMenuA error %u\n", GetLastError());
SetLastError(0xdeadbeef);
- hmenu = LoadMenuA(GetModuleHandle(0), MAKEINTRESOURCE(1));
+ hmenu = LoadMenuA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(1));
ok(hmenu != 0, "LoadMenuA error %u\n", GetLastError());
SetMenu(hwnd, hmenu);
SetForegroundWindow( hwnd );
+ flush_events();
set_menu_style(hmenu, MNS_NOTIFYBYPOS);
style = get_menu_style(hmenu);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
if (!sequence_cnt) /* we didn't get any message */
{
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(wm_popup_menu_2, "submenu of a popup menu command", FALSE);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_ESCAPE, 0, 0, 0);
keybd_event(VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(wm_single_menu_item, "single menu item command", FALSE);
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(wm_popup_menu_3, "submenu of a popup menu command", FALSE);
{
HWND hwnd;
- paint_loop_done = 0;
+ paint_loop_done = FALSE;
hwnd = CreateWindowExA(0x0,"PaintLoopWindowClass",
"PaintLoopWindowClass",WS_OVERLAPPEDWINDOW,
100, 100, 100, 100, 0, 0, 0, NULL );
if (PeekMessageA(&msg, 0, 0, 0, 1))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
}
DestroyWindow(hwnd);
{
HWND hwnd;
MSG msg;
- int gotwmquit = FALSE;
+ BOOL gotwmquit = FALSE;
hwnd = CreateWindowExA(0, "static", "test_defwndproc", WS_POPUP, 0,0,0,0,0,0,0, NULL);
assert(hwnd);
DefWindowProcA( hwnd, WM_ENDSESSION, 1, 0);
if( msg.message == WM_QUIT) gotwmquit = TRUE;
DispatchMessageA( &msg );
}
- ok( gotwmquit == FALSE, "Unexpected WM_QUIT message!\n");
+ ok(!gotwmquit, "Unexpected WM_QUIT message!\n");
DestroyWindow( hwnd);
}
flush_events();
- PostMessage(hwnd, WM_USER+1, 0x1234, 0x5678);
- PostMessage(0, WM_USER+2, 0x5678, 0x1234);
+ PostMessageA(hwnd, WM_USER+1, 0x1234, 0x5678);
+ PostMessageA(0, WM_USER+2, 0x5678, 0x1234);
for (i = 0; i < sizeof(data)/sizeof(data[0]); i++)
{
{
MSG msg;
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
return 0;
static void do_wait_idle_child( int arg )
{
- WNDCLASS cls;
+ WNDCLASSA cls;
MSG msg;
HWND hwnd = 0;
HANDLE thread;
HANDLE end_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_end" );
memset( &cls, 0, sizeof(cls) );
- cls.lpfnWndProc = DefWindowProc;
+ cls.lpfnWndProc = DefWindowProcA;
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- cls.hCursor = LoadCursor(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.lpszClassName = "TestClass";
- RegisterClass( &cls );
+ RegisterClassA( &cls );
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* create the msg queue */
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); /* create the msg queue */
ok( start_event != 0, "failed to create start event, error %u\n", GetLastError() );
ok( end_event != 0, "failed to create end event, error %u\n", GetLastError() );
case 1:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, 0, 0, 0, PM_REMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_REMOVE );
break;
case 2:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
- PostThreadMessage( GetCurrentThreadId(), WM_COMMAND, 0x1234, 0xabcd );
- PeekMessage( &msg, 0, 0, 0, PM_REMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
+ PostThreadMessageA( GetCurrentThreadId(), WM_COMMAND, 0x1234, 0xabcd );
+ PeekMessageA( &msg, 0, 0, 0, PM_REMOVE );
break;
case 3:
SetEvent( start_event );
Sleep( 200 );
- SendMessage( HWND_BROADCAST, WM_WININICHANGE, 0, 0 );
+ SendMessageA( HWND_BROADCAST, WM_WININICHANGE, 0, 0 );
break;
case 4:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg );
break;
case 5:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
break;
case 6:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
- while (PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ))
+ while (PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ))
{
- GetMessage( &msg, 0, 0, 0 );
- DispatchMessage( &msg );
+ GetMessageA( &msg, 0, 0, 0 );
+ DispatchMessageA( &msg );
}
break;
case 7:
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
SetTimer( hwnd, 3, 1, NULL );
Sleep( 200 );
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg );
break;
case 8:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
break;
case 9:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
- for (;;) GetMessage( &msg, 0, 0, 0 );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
+ for (;;) GetMessageA( &msg, 0, 0, 0 );
break;
case 10:
SetEvent( start_event );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
SetTimer( hwnd, 3, 1, NULL );
Sleep( 200 );
- while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
+ while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
break;
case 11:
SetEvent( start_event );
Sleep( 200 );
return; /* exiting the process makes WaitForInputIdle return success too */
case 12:
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
SetEvent( start_event );
break;
case 13:
SetEvent( start_event );
- PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
thread = CreateThread( NULL, 0, do_wait_idle_child_thread, NULL, 0, &id );
WaitForSingleObject( thread, 10000 );
case 14:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, HWND_TOPMOST, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, HWND_TOPMOST, 0, 0, PM_NOREMOVE );
break;
case 15:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, HWND_BROADCAST, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, HWND_BROADCAST, 0, 0, PM_NOREMOVE );
break;
case 16:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, HWND_BOTTOM, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, HWND_BOTTOM, 0, 0, PM_NOREMOVE );
break;
case 17:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, (HWND)0xdeadbeef, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, (HWND)0xdeadbeef, 0, 0, PM_NOREMOVE );
break;
case 18:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, HWND_NOTOPMOST, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, HWND_NOTOPMOST, 0, 0, PM_NOREMOVE );
break;
case 19:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, HWND_MESSAGE, 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, HWND_MESSAGE, 0, 0, PM_NOREMOVE );
break;
case 20:
SetEvent( start_event );
Sleep( 200 );
- PeekMessage( &msg, GetDesktopWindow(), 0, 0, PM_NOREMOVE );
+ PeekMessageA( &msg, GetDesktopWindow(), 0, 0, PM_NOREMOVE );
break;
}
WaitForSingleObject( end_event, 2000 );
static DWORD CALLBACK wait_idle_thread( void *arg )
{
- WNDCLASS cls;
+ WNDCLASSA cls;
MSG msg;
HWND hwnd;
memset( &cls, 0, sizeof(cls) );
cls.lpfnWndProc = wait_idle_proc;
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- cls.hCursor = LoadCursor(0, IDC_ARROW);
+ cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.lpszClassName = "TestClass";
- RegisterClass( &cls );
+ RegisterClassA( &cls );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
- while (GetMessage( &msg, 0, 0, 0 )) DispatchMessage( &msg );
+ while (GetMessageA( &msg, 0, 0, 0 )) DispatchMessageA( &msg );
DestroyWindow(hwnd);
return 0;
}
}
}
CloseHandle( start_event );
- PostThreadMessage( id, WM_QUIT, 0, 0 );
+ PostThreadMessageA( id, WM_QUIT, 0, 0 );
WaitForSingleObject( thread, 10000 );
CloseHandle( thread );
}
HWND parent1, parent2, child, popup;
RECT rc, rc_old;
- parent1 = CreateWindowEx(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
+ parent1 = CreateWindowExA(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
ok(parent1 != 0, "Failed to create parent1 window\n");
- parent2 = CreateWindowEx(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
+ parent2 = CreateWindowExA(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
400, 100, 200, 200, 0, 0, 0, NULL);
ok(parent2 != 0, "Failed to create parent2 window\n");
/* WS_CHILD window */
- child = CreateWindowEx(0, "TestWindowClass", NULL, WS_CHILD | WS_VISIBLE,
+ child = CreateWindowExA(0, "TestWindowClass", NULL, WS_CHILD | WS_VISIBLE,
10, 10, 150, 150, parent1, 0, 0, NULL);
ok(child != 0, "Failed to create child window\n");
rc.left, rc.top, rc.right, rc.bottom );
/* WS_POPUP window */
- popup = CreateWindowEx(0, "TestWindowClass", NULL, WS_POPUP | WS_VISIBLE,
+ popup = CreateWindowExA(0, "TestWindowClass", NULL, WS_POPUP | WS_VISIBLE,
20, 20, 100, 100, 0, 0, 0, NULL);
ok(popup != 0, "Failed to create popup window\n");
BYTE keyboard_state[256];
MSG msg;
- test_window = CreateWindowEx(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ test_window = CreateWindowExA(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 200, 200, 0, 0, 0, NULL);
flush_events();
/* keyup without a keydown */
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyReleaseOnly, "key release only", TRUE);
key_state = GetAsyncKeyState(0x41);
/* keydown */
keybd_event(0x41, 0, 0, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyPressNormal, "key press only", FALSE);
key_state = GetAsyncKeyState(0x41);
/* keydown repeat */
keybd_event(0x41, 0, 0, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyPressRepeat, "key press repeat", FALSE);
key_state = GetAsyncKeyState(0x41);
/* keyup */
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyReleaseNormal, "key release repeat", FALSE);
key_state = GetAsyncKeyState(0x41);
/* keydown */
keybd_event(0x41, 0, 0, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyPressRepeat, "key press after setkeyboardstate", TRUE);
key_state = GetAsyncKeyState(0x41);
/* keyup */
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmKeyReleaseOnly, "key release after setkeyboardstate", TRUE);
key_state = GetAsyncKeyState(0x41);
return;
}
- test_window = CreateWindowEx(0, "HotkeyWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ test_window = CreateWindowExA(0, "HotkeyWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 200, 200, 0, 0, 0, NULL);
flush_sequence();
goto end;
}
- hKBD_hook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProc, GetModuleHandle(NULL), 0);
+ hKBD_hook = SetWindowsHookExA(WH_KEYBOARD_LL, KeyboardHookProc, GetModuleHandleA(NULL), 0);
if (!hKBD_hook) win_skip("WH_KEYBOARD_LL is not supported\n");
/* Same key combination, different id */
/* Inject the appropriate key sequence */
keybd_event(VK_LWIN, 0, 0, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmHotkeyPressLWIN, "window hotkey press LWIN", FALSE);
keybd_event(hotkey_letter, 0, 0, 0);
queue_status = GetQueueStatus(QS_HOTKEY);
ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %x\n", queue_status);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_HOTKEY)
{
ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyPress, "window hotkey press", FALSE);
ok((key_state & 0x8000) == 0x8000, "unexpected key state %x\n", key_state);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmHotkeyRelease, "window hotkey release", TRUE);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmHotkeyReleaseLWIN, "window hotkey release LWIN", FALSE);
/* normal posted WM_HOTKEY messages set QS_HOTKEY */
- PostMessage(test_window, WM_HOTKEY, 0, 0);
+ PostMessageA(test_window, WM_HOTKEY, 0, 0);
queue_status = GetQueueStatus(QS_HOTKEY);
ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %x\n", queue_status);
queue_status = GetQueueStatus(QS_POSTMESSAGE);
ok((queue_status & (QS_POSTMESSAGE << 16)) == QS_POSTMESSAGE << 16, "expected QS_POSTMESSAGE << 16 set, got %x\n", queue_status);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
flush_sequence();
/* Send and process all messages at once */
- PostMessage(test_window, WM_APP, 0, 0);
+ PostMessageA(test_window, WM_APP, 0, 0);
keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(hotkey_letter, 0, 0, 0);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_HOTKEY)
{
ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyCombined, "window hotkey combined", FALSE);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
+ DispatchMessageA(&msg);
ok_sequence(WmHotkeyPrevious, "window hotkey previous", FALSE);
/* New key combination works */
keybd_event(hotkey_letter, 0, 0, 0);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_HOTKEY)
{
ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
ok(msg.lParam == MAKELPARAM(0, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
}
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyNew, "window hotkey new", FALSE);
/* Inject the appropriate key sequence */
keybd_event(VK_LWIN, 0, 0, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyPressLWIN, "thread hotkey press LWIN", FALSE);
keybd_event(hotkey_letter, 0, 0, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_HOTKEY)
{
}
else
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyPress, "thread hotkey press", FALSE);
keybd_event(hotkey_letter, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyRelease, "thread hotkey release", TRUE);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
{
ok(msg.hwnd != NULL, "unexpected thread message %x\n", msg.message);
- DispatchMessage(&msg);
+ DispatchMessageA(&msg);
}
ok_sequence(WmHotkeyReleaseLWIN, "thread hotkey release LWIN", FALSE);
HANDLE hthread;
DWORD ret, tid;
- wnd_event.start_event = CreateEvent(NULL, 0, 0, NULL);
+ wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL);
ok(wnd_event.start_event != 0, "CreateEvent error %d\n", GetLastError());
hthread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
ok(hthread != 0, "CreateThread error %d\n", GetLastError());
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(wnd_event.start_event);
- parent = CreateWindowEx(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
+ parent = CreateWindowExA(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW,
0, 0, 0, 0, 0, 0, 0, NULL);
ok(parent != 0, "failed to create parent window\n");
- child = CreateWindowEx(0, "TestWindowClass", NULL, WS_CHILD,
+ child = CreateWindowExA(0, "TestWindowClass", NULL, WS_CHILD,
0, 0, 0, 0, parent, 0, 0, NULL);
ok(child != 0, "failed to create child window\n");
log_all_parent_messages++;
old_focus = SetFocus(child);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmSetFocus_1, "SetFocus on a child window", TRUE);
ok(old_focus == parent, "expected old focus %p, got %p\n", parent, old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
ok(GetFocus() == child, "expected focus %p, got %p\n", child, GetFocus());
old_focus = SetFocus(parent);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmSetFocus_2, "SetFocus on a parent window", FALSE);
ok(old_focus == child, "expected old focus %p, got %p\n", child, old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_focus = SetFocus((HWND)0xdeadbeef);
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
"expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetFocus on an invalid window", FALSE);
ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_focus = SetFocus(GetDesktopWindow());
ok(GetLastError() == ERROR_ACCESS_DENIED /* Vista+ */ ||
broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetFocus on a desktop window", TRUE);
ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_focus = SetFocus(wnd_event.hwnd);
ok(GetLastError() == ERROR_ACCESS_DENIED /* Vista+ */ ||
broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetFocus on another thread window", TRUE);
ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_active = SetActiveWindow((HWND)0xdeadbeef);
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
"expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetActiveWindow on an invalid window", FALSE);
ok(old_active == 0, "expected old focus 0, got %p\n", old_active);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_active = SetActiveWindow(GetDesktopWindow());
todo_wine
ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetActiveWindow on a desktop window", TRUE);
ok(old_active == 0, "expected old focus 0, got %p\n", old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
old_active = SetActiveWindow(wnd_event.hwnd);
todo_wine
ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetActiveWindow on another thread window", TRUE);
ok(old_active == 0, "expected old focus 0, got %p\n", old_active);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
flush_sequence();
old_focus = SetFocus(wnd_event.hwnd);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(old_focus == wnd_event.hwnd, "expected old focus %p, got %p\n", wnd_event.hwnd, old_focus);
ok(GetActiveWindow() == wnd_event.hwnd, "expected active %p, got %p\n", wnd_event.hwnd, GetActiveWindow());
ok(GetFocus() == wnd_event.hwnd, "expected focus %p, got %p\n", wnd_event.hwnd, GetFocus());
old_focus = SetFocus(parent);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(old_focus == parent, "expected old focus %p, got %p\n", parent, old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
ok(GetFocus() == parent, "expected focus %p, got %p\n", parent, GetFocus());
flush_sequence();
old_active = SetActiveWindow(wnd_event.hwnd);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(old_active == parent, "expected old focus %p, got %p\n", parent, old_active);
ok(GetActiveWindow() == wnd_event.hwnd, "expected active %p, got %p\n", wnd_event.hwnd, GetActiveWindow());
ok(GetFocus() == wnd_event.hwnd, "expected focus %p, got %p\n", wnd_event.hwnd, GetFocus());
ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
old_focus = SetFocus(parent);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok(old_focus == parent, "expected old focus %p, got %p\n", parent, old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
ok(GetFocus() == parent, "expected focus %p, got %p\n", parent, GetFocus());
ok(GetLastError() == ERROR_INVALID_PARAMETER /* Vista+ */ ||
broken(GetLastError() == 0) /* XP */ ||
broken(GetLastError() == 0xdeadbeef), "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmSetFocus_3, "SetFocus on a child window", TRUE);
ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
SetLastError(0xdeadbeef);
old_active = SetActiveWindow(child);
ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
+ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(WmEmptySeq, "SetActiveWindow on a child window", FALSE);
ok(old_active == parent, "expected old active %p, got %p\n", parent, old_active);
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
DestroyWindow(child);
DestroyWindow(parent);
- ret = PostMessage(wnd_event.hwnd, WM_QUIT, 0, 0);
+ ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
ok(ret, "PostMessage(WM_QUIT) error %d\n", GetLastError());
ret = WaitForSingleObject(hthread, INFINITE);
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
CloseHandle(hthread);
}
+static const struct message WmSetLayeredStyle[] = {
+ { WM_STYLECHANGING, sent },
+ { WM_STYLECHANGED, sent },
+ { WM_GETTEXT, sent|defwinproc|optional },
+ { 0 }
+};
+
+static const struct message WmSetLayeredStyle2[] = {
+ { WM_STYLECHANGING, sent },
+ { WM_STYLECHANGED, sent },
+ { WM_WINDOWPOSCHANGING, sent|optional|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
+ { WM_NCCALCSIZE, sent|optional|wparam|defwinproc, 1 },
+ { WM_WINDOWPOSCHANGED, sent|optional|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
+ { WM_MOVE, sent|optional|defwinproc|wparam, 0 },
+ { WM_SIZE, sent|optional|defwinproc|wparam, SIZE_RESTORED },
+ { 0 }
+};
+
+struct layered_window_info
+{
+ HWND hwnd;
+ HDC hdc;
+ SIZE size;
+ HANDLE event;
+ BOOL ret;
+};
+
+static DWORD CALLBACK update_layered_proc( void *param )
+{
+ struct layered_window_info *info = param;
+ POINT src = { 0, 0 };
+
+ info->ret = pUpdateLayeredWindow( info->hwnd, 0, NULL, &info->size,
+ info->hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( info->ret, "failed\n");
+ SetEvent( info->event );
+ return 0;
+}
+
+static void test_layered_window(void)
+{
+ HWND hwnd;
+ HDC hdc;
+ HBITMAP bmp;
+ BOOL ret;
+ SIZE size;
+ POINT pos, src;
+ RECT rect, client;
+ HANDLE thread;
+ DWORD tid;
+ struct layered_window_info info;
+
+ if (!pUpdateLayeredWindow)
+ {
+ win_skip( "UpdateLayeredWindow not supported\n" );
+ return;
+ }
+
+ hdc = CreateCompatibleDC( 0 );
+ bmp = CreateCompatibleBitmap( hdc, 300, 300 );
+ SelectObject( hdc, bmp );
+
+ hwnd = CreateWindowExA(0, "TestWindowClass", NULL, WS_CAPTION | WS_THICKFRAME | WS_SYSMENU,
+ 100, 100, 300, 300, 0, 0, 0, NULL);
+ ok( hwnd != 0, "failed to create window\n" );
+ ShowWindow( hwnd, SW_SHOWNORMAL );
+ UpdateWindow( hwnd );
+ flush_events();
+ flush_sequence();
+
+ GetWindowRect( hwnd, &rect );
+ GetClientRect( hwnd, &client );
+ ok( client.right < rect.right - rect.left, "wrong client area\n" );
+ ok( client.bottom < rect.bottom - rect.top, "wrong client area\n" );
+
+ src.x = src.y = 0;
+ pos.x = pos.y = 300;
+ size.cx = size.cy = 250;
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ ok_sequence( WmSetLayeredStyle, "WmSetLayeredStyle", FALSE );
+
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+ ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 300 && rect.top == 300 && rect.right == 550 && rect.bottom == 550,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( rect.right == client.right - 50 && rect.bottom == client.bottom - 50,
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ size.cx = 150;
+ pos.y = 200;
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+ ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 300 && rect.top == 200 && rect.right == 450 && rect.bottom == 450,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( rect.right == client.right - 150 && rect.bottom == client.bottom - 50,
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ SetWindowLongA( hwnd, GWL_STYLE,
+ GetWindowLongA(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_SYSMENU) );
+ ok_sequence( WmSetLayeredStyle2, "WmSetLayeredStyle2", FALSE );
+
+ size.cx = 200;
+ pos.x = 200;
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+ ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 200 && rect.top == 200 && rect.right == 400 && rect.bottom == 450,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( (rect.right == 200 && rect.bottom == 250) ||
+ broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50),
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ size.cx = 0;
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(ERROR_MR_MID_NOT_FOUND) /* win7 */,
+ "wrong error %u\n", GetLastError() );
+ size.cx = 1;
+ size.cy = -1;
+ ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
+ ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
+ ok_sequence( WmSetLayeredStyle, "WmSetLayeredStyle", FALSE );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 200 && rect.top == 200 && rect.right == 400 && rect.bottom == 450,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( (rect.right == 200 && rect.bottom == 250) ||
+ broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50),
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ info.hwnd = hwnd;
+ info.hdc = hdc;
+ info.size.cx = 250;
+ info.size.cy = 300;
+ info.event = CreateEventA( NULL, TRUE, FALSE, NULL );
+ info.ret = FALSE;
+ thread = CreateThread( NULL, 0, update_layered_proc, &info, 0, &tid );
+ ok( WaitForSingleObject( info.event, 1000 ) == 0, "wait failed\n" );
+ ok( info.ret, "UpdateLayeredWindow failed in other thread\n" );
+ WaitForSingleObject( thread, 1000 );
+ CloseHandle( thread );
+ GetWindowRect( hwnd, &rect );
+ ok( rect.left == 200 && rect.top == 200 && rect.right == 450 && rect.bottom == 500,
+ "wrong window rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+ GetClientRect( hwnd, &rect );
+ ok( (rect.right == 250 && rect.bottom == 300) ||
+ broken(rect.right == client.right - 50 && rect.bottom == client.bottom),
+ "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
+
+ DestroyWindow( hwnd );
+ DeleteDC( hdc );
+ DeleteObject( bmp );
+}
+
+static void init_funcs(void)
+{
+ HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f)
+ X(ActivateActCtx);
+ X(CreateActCtxW);
+ X(DeactivateActCtx);
+ X(GetCurrentActCtx);
+ X(ReleaseActCtx);
+#undef X
+}
+
START_TEST(msg)
{
char **test_argv;
BOOL (WINAPI *pIsWinEventHookInstalled)(DWORD)= 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/
HMODULE hModuleImm32;
BOOL (WINAPI *pImmDisableIME)(DWORD);
+ int argc;
- int argc = winetest_get_mainargs( &test_argv );
+ init_funcs();
+
+ argc = winetest_get_mainargs( &test_argv );
if (argc >= 3)
{
unsigned int arg;
return;
}
+ InitializeCriticalSection( &sequence_cs );
init_procs();
- hModuleImm32 = LoadLibrary("imm32.dll");
+ hModuleImm32 = LoadLibraryA("imm32.dll");
if (hModuleImm32) {
pImmDisableIME = (void *)GetProcAddress(hModuleImm32, "ImmDisableIME");
if (pImmDisableIME)
test_winevents();
/* Fix message sequences before removing 4 lines below */
-#if 1
if (pUnhookWinEvent && hEvent_hook)
{
ret = pUnhookWinEvent(hEvent_hook);
pUnhookWinEvent = 0;
}
hEvent_hook = 0;
-#endif
test_SetFocus();
test_SetParent();
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_EndDialog();
test_nullCallback();
test_dbcs_wm_char();
+ test_unicode_wm_char();
test_menu_messages();
test_paintingloop();
test_defwinproc();
test_clipboard_viewers();
test_keyflags();
test_hotkey();
+ test_layered_window();
/* keep it the last test, under Windows it tends to break the tests
* which rely on active/foreground windows being correct.
*/
GetLastError() == 0xdeadbeef, /* Win9x */
"unexpected error %d\n", GetLastError());
}
+ DeleteCriticalSection( &sequence_cs );
}