ReactOS 0.4.15-dev-5666-gc548b97
msg.c
Go to the documentation of this file.
1/*
2 * Unit tests for window message handling
3 *
4 * Copyright 1999 Ove Kaaven
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2004,2005,2016 Dmitry Timoshkov
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include <assert.h>
24#include <limits.h>
25#include <stdarg.h>
26#include <stdio.h>
27
28#include "windef.h"
29#include "winbase.h"
30#include "wingdi.h"
31#include "winuser.h"
32#include "winnls.h"
33#include "dbt.h"
34
35#include "wine/test.h"
36
37#define MDI_FIRST_CHILD_ID 2004
38
39/* undocumented SWP flags - from SDK 3.1 */
40#define SWP_NOCLIENTSIZE 0x0800
41#define SWP_NOCLIENTMOVE 0x1000
42#define SWP_STATECHANGED 0x8000
43
44#define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */
45
46#ifndef WM_KEYF1
47#define WM_KEYF1 0x004d
48#endif
49
50#ifndef WM_SYSTIMER
51#define WM_SYSTIMER 0x0118
52#endif
53
54#define WND_PARENT_ID 1
55#define WND_POPUP_ID 2
56#define WND_CHILD_ID 3
57
58#ifndef WM_LBTRACKPOINT
59#define WM_LBTRACKPOINT 0x0131
60#endif
61
62#ifdef __i386__
63#define ARCH "x86"
64#elif defined __x86_64__
65#define ARCH "amd64"
66#elif defined __arm__
67#define ARCH "arm"
68#elif defined __aarch64__
69#define ARCH "arm64"
70#else
71#define ARCH "none"
72#endif
73
74static BOOL (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
75static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
76static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
77static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
78static BOOL (WINAPI *pQueryActCtxW)(DWORD,HANDLE,void*,ULONG,void*,SIZE_T,SIZE_T*);
79static void (WINAPI *pReleaseActCtx)(HANDLE);
80
81/* encoded DRAWITEMSTRUCT into an LPARAM */
82typedef struct
83{
84 union
85 {
86 struct
87 {
88 UINT type : 4; /* ODT_* flags */
89 UINT ctl_id : 4; /* Control ID */
90 UINT item_id : 4; /* Menu item ID */
91 UINT action : 4; /* ODA_* flags */
92 UINT state : 16; /* ODS_* flags */
95 } u;
97
98/* encoded MEASUREITEMSTRUCT into a WPARAM */
99typedef struct
100{
101 union
102 {
103 struct
104 {
105 UINT CtlType : 4;
106 UINT CtlID : 4;
107 UINT itemID : 4;
108 UINT wParam : 20;
110 WPARAM wp;
111 } u;
113
117static HHOOK hKBD_hook;
118static HHOOK hCBT_hook;
120
121static const WCHAR testWindowClassW[] =
122{ 'T','e','s','t','W','i','n','d','o','w','C','l','a','s','s','W',0 };
123
125
126/*
127FIXME: add tests for these
128Window Edge Styles (Win31/Win95/98 look), in order of precedence:
129 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
130 WS_THICKFRAME: thick border
131 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
132 WS_BORDER (default for overlapped windows): single black border
133 none (default for child (and popup?) windows): no border
134*/
135
136typedef enum {
137 sent=0x1,
141 lparam=0x10,
145 hook=0x100,
147 kbd_hook=0x400
149
150struct message {
151 UINT message; /* the WM_* code */
152 msg_flags_t flags; /* message props */
153 WPARAM wParam; /* expected value of wParam */
154 LPARAM lParam; /* expected value of lParam */
155 WPARAM wp_mask; /* mask for wParam checks */
156 LPARAM lp_mask; /* mask for lParam checks */
157};
158
160 UINT message; /* the WM_* code */
161 msg_flags_t flags; /* message props */
162 HWND hwnd; /* window that received the message */
163 WPARAM wParam; /* expected value of wParam */
164 LPARAM lParam; /* expected value of lParam */
165 int line; /* source line where logged */
166 const char *descr; /* description for trace output */
167 char output[512]; /* trace output */
168};
169
170/* Empty message sequence */
171static const struct message WmEmptySeq[] =
172{
173 { 0 }
174};
175/* CreateWindow (for overlapped window, not initially visible) (16/32) */
176static const struct message WmCreateOverlappedSeq[] = {
177 { HCBT_CREATEWND, hook },
179 { WM_NCCREATE, sent },
180 { WM_NCCALCSIZE, sent|wparam, 0 },
181 { 0x0093, sent|defwinproc|optional },
182 { 0x0094, sent|defwinproc|optional },
183 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
184 { WM_CREATE, sent },
185 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
186 { 0 }
187};
188/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
189 * for a not visible overlapped window.
190 */
191static const struct message WmSWP_ShowOverlappedSeq[] = {
193 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
197 { HCBT_ACTIVATE, hook },
198 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
199 { WM_NOTIFYFORMAT, sent|optional },
200 { WM_QUERYUISTATE, sent|optional },
202 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x: SWP_NOSENDCHANGING */
203 { WM_ACTIVATEAPP, sent|wparam, 1 },
204 { WM_NCACTIVATE, sent },
206 { WM_ACTIVATE, sent|wparam, 1 },
207 { HCBT_SETFOCUS, hook },
210 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
216 /* Win9x adds SWP_NOZORDER below */
222 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
229 { 0 }
230};
231/* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE)
232 * for a visible overlapped window.
233 */
234static const struct message WmSWP_HideOverlappedSeq[] = {
236 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
243 { 0 }
244};
245
246/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
247 * for a visible overlapped window.
248 */
249static const struct message WmSWP_ResizeSeq[] = {
262 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
263 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
264 { 0 }
265};
266
267/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
268 * for a visible popup window.
269 */
270static const struct message WmSWP_ResizePopupSeq[] = {
272 { WM_GETMINMAXINFO, sent|defwinproc|optional }, /* Win9x */
283 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
284 { 0 }
285};
286
287/* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE)
288 * for a visible overlapped window.
289 */
290static const struct message WmSWP_MoveSeq[] = {
297 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
298 { 0 }
299};
300/* Resize with SetWindowPos(SWP_NOZORDER)
301 * for a visible overlapped window
302 * SWP_NOZORDER is stripped by the logging code
303 */
304static const struct message WmSWP_ResizeNoZOrder[] = {
305 { WM_WINDOWPOSCHANGING, sent|wparam, /*SWP_NOZORDER|*/SWP_NOACTIVATE },
311 { WM_WINDOWPOSCHANGED, sent|wparam|optional, /*SWP_NOZORDER|*/SWP_NOACTIVATE, 0,
315 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
316 { WM_NCPAINT, sent|optional }, /* Win9x doesn't send it */
317 { WM_GETTEXT, sent|defwinproc|optional }, /* Win9x doesn't send it */
318 { WM_ERASEBKGND, sent|optional }, /* Win9x doesn't send it */
319 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
320 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
321 { 0 }
322};
323
324/* Switch visible mdi children */
325static const struct message WmSwitchChild[] = {
326 /* Switch MDI child */
327 { WM_MDIACTIVATE, sent },/* in the MDI client */
328 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 1st MDI child */
329 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
330 { WM_CHILDACTIVATE, sent },/* in the 1st MDI child */
331 /* Deactivate 2nd MDI child */
332 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
333 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
335 /* Preparing for maximize and maximize the 1st MDI child */
336 { WM_GETMINMAXINFO, sent|defwinproc }, /* in the 1st MDI child */
338 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
339 { WM_CHILDACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
341 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED }, /* in the 1st MDI child */
342 /* Lock redraw 2nd MDI child */
343 { WM_SETREDRAW, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
345 /* Restore 2nd MDI child */
347 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
348 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
350 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED }, /* in the 2nd MDI child */
351 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
352 /* Redraw 2nd MDI child */
353 { WM_SETREDRAW, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
354 /* Redraw MDI frame */
356 { WM_NCCALCSIZE, sent|wparam, 1 },/* in MDI frame */
358 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in MDI frame */
359 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
361 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
362 { HCBT_SETFOCUS, hook },
363 { WM_KILLFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
364 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },/* in the 1st MDI child */
365 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
366 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
367 { WM_SETFOCUS, sent },/* in the MDI client */
368 { HCBT_SETFOCUS, hook },
369 { WM_KILLFOCUS, sent },/* in the MDI client */
370 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
371 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, /* in the 1st MDI child */
372 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
373 { WM_SETFOCUS, sent|defwinproc }, /* in the 1st MDI child */
374 { WM_MDIACTIVATE, sent|defwinproc },/* in the 1st MDI child */
376 { 0 }
377};
378
379/* Switch visible not maximized mdi children */
380static const struct message WmSwitchNotMaximizedChild[] = {
381 /* Switch not maximized MDI child */
382 { WM_MDIACTIVATE, sent },/* in the MDI client */
383 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 2nd MDI child */
384 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
385 { WM_CHILDACTIVATE, sent },/* in the 2nd MDI child */
386 /* Deactivate 1st MDI child */
387 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
388 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
389 /* Activate 2nd MDI child */
391 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 2nd MDI child */
392 { HCBT_SETFOCUS, hook }, /* in the 1st MDI child */
393 { WM_KILLFOCUS, sent|defwinproc }, /* in the 1st MDI child */
394 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
395 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
396 { WM_SETFOCUS, sent, 0 }, /* in the MDI client */
397 { HCBT_SETFOCUS, hook },
398 { WM_KILLFOCUS, sent }, /* in the MDI client */
399 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
400 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
401 { WM_SETFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
402 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
404 { 0 }
405};
406
407
408/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
409 SWP_NOZORDER|SWP_FRAMECHANGED)
410 * for a visible overlapped window with WS_CLIPCHILDREN style set.
411 */
412static const struct message WmSWP_FrameChanged_clip[] = {
415 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
417 { WM_ERASEBKGND, sent|parent|optional }, /* FIXME: remove optional once Wine is fixed */
418 { WM_NCPAINT, sent }, /* wparam != 1 */
419 { WM_ERASEBKGND, sent },
421 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
422 { WM_PAINT, sent },
423 { 0 }
424};
425/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|
426 SWP_NOZORDER|SWP_FRAMECHANGED)
427 * for a visible overlapped window.
428 */
429static const struct message WmSWP_FrameChangedDeferErase[] = {
433 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
435 { WM_NCPAINT, sent|beginpaint|parent|optional }, /* wparam != 1 */
437 { WM_PAINT, sent },
438 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
440 { 0 }
441};
442
443/* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
444 SWP_NOZORDER|SWP_FRAMECHANGED)
445 * for a visible overlapped window without WS_CLIPCHILDREN style set.
446 */
447static const struct message WmSWP_FrameChanged_noclip[] = {
450 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
454 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
455 { WM_PAINT, sent },
456 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
458 { 0 }
459};
460
461/* ShowWindow(SW_SHOW) for a not visible overlapped window */
462static const struct message WmShowOverlappedSeq[] = {
463 { WM_SHOWWINDOW, sent|wparam, 1 },
466 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
471 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
482 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
488 /* Win9x adds SWP_NOZORDER below */
495#if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE
496 * messages. Does that mean that CreateWindow doesn't set initial
497 * window dimensions for overlapped windows?
498 */
499 { WM_SIZE, sent },
500 { WM_MOVE, sent },
501#endif
504 { 0 }
505};
506/* ShowWindow(SW_SHOWMAXIMIZED) for a not visible overlapped window */
507static const struct message WmShowMaxOverlappedSeq[] = {
513 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
515 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
525 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
531 /* Win9x adds SWP_NOZORDER below */
539 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
540 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
546 { 0 }
547};
548/* ShowWindow(SW_RESTORE) for a not visible maximized overlapped window */
549static const struct message WmShowRestoreMaxOverlappedSeq[] = {
569 { 0 }
570};
571/* ShowWindow(SW_RESTORE) for a not visible minimized overlapped window */
572static const struct message WmShowRestoreMinOverlappedSeq[] = {
577 { WM_WINDOWPOSCHANGING, sent|optional }, /* SWP_NOSIZE|SWP_NOMOVE */
580 { WM_MOVE, sent|optional },
600 { WM_ERASEBKGND, sent },
611 { WM_ACTIVATE, sent|wparam, 1 },
617 { 0 }
618};
619/* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
620static const struct message WmShowMinOverlappedSeq[] = {
623 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
631 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
638 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
639 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
640 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
645
646 /* Vista sometimes restores the window right away... */
672
676 { 0 }
677};
678/* ShowWindow(SW_HIDE) for a visible overlapped window */
679static const struct message WmHideOverlappedSeq[] = {
680 { WM_SHOWWINDOW, sent|wparam, 0 },
682 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
684 { WM_SIZE, sent|optional }, /* XP doesn't send it */
685 { WM_MOVE, sent|optional }, /* XP doesn't send it */
693 { 0 }
694};
695/* DestroyWindow for a visible overlapped window */
696static const struct message WmDestroyOverlappedSeq[] = {
698 { 0x0090, sent|optional },
700 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
701 { 0x0090, sent|optional },
709 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
710 { WM_DESTROY, sent },
711 { WM_NCDESTROY, sent },
712 { 0 }
713};
714/* CreateWindow(WS_MAXIMIZE|WS_VISIBLE) for popup window */
715static const struct message WmCreateMaxPopupSeq[] = {
716 { HCBT_CREATEWND, hook },
717 { WM_NCCREATE, sent },
718 { WM_NCCALCSIZE, sent|wparam, 0 },
719 { WM_CREATE, sent },
720 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
722 { WM_MOVE, sent },
730 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
731 { WM_SHOWWINDOW, sent|wparam, 1 },
733 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
734 { HCBT_ACTIVATE, hook },
735 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
741 { WM_ACTIVATEAPP, sent|wparam, 1 },
742 { WM_NCACTIVATE, sent },
743 { WM_ACTIVATE, sent|wparam, 1 },
744 { HCBT_SETFOCUS, hook },
747 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
756 { 0 }
757};
758/* CreateWindow(WS_MAXIMIZE) for popup window, not initially visible */
759static const struct message WmCreateInvisibleMaxPopupSeq[] = {
760 { HCBT_CREATEWND, hook },
761 { WM_NCCREATE, sent },
762 { WM_NCCALCSIZE, sent|wparam, 0 },
763 { WM_CREATE, sent },
764 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
766 { WM_MOVE, sent },
774 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
775 { 0 }
776};
777/* ShowWindow(SW_SHOWMAXIMIZED) for a resized not visible popup window */
778static const struct message WmShowMaxPopupResizedSeq[] = {
783 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
784 { HCBT_ACTIVATE, hook },
785 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
791 { WM_ACTIVATEAPP, sent|wparam, 1 },
792 { WM_NCACTIVATE, sent },
793 { WM_ACTIVATE, sent|wparam, 1 },
794 { HCBT_SETFOCUS, hook },
797 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
803 /* WinNT4.0 sends WM_MOVE */
806 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
807 { 0 }
808};
809/* ShowWindow(SW_SHOWMAXIMIZED) for a not visible popup window */
810static const struct message WmShowMaxPopupSeq[] = {
815 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
816 { HCBT_ACTIVATE, hook },
817 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
823 { WM_ACTIVATEAPP, sent|wparam, 1 },
824 { WM_NCACTIVATE, sent },
825 { WM_ACTIVATE, sent|wparam, 1 },
826 { HCBT_SETFOCUS, hook },
829 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
838 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
840 { 0 }
841};
842/* CreateWindow(WS_VISIBLE) for popup window */
843static const struct message WmCreatePopupSeq[] = {
844 { HCBT_CREATEWND, hook },
845 { WM_NCCREATE, sent },
846 { WM_NCCALCSIZE, sent|wparam, 0 },
847 { WM_CREATE, sent },
848 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
850 { WM_MOVE, sent },
851 { WM_SHOWWINDOW, sent|wparam, 1 },
853 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
854 { HCBT_ACTIVATE, hook },
855 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
861 { WM_ACTIVATEAPP, sent|wparam, 1 },
862 { WM_NCACTIVATE, sent },
863 { WM_ACTIVATE, sent|wparam, 1 },
864 { HCBT_SETFOCUS, hook },
867 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
874 { 0 }
875};
876/* ShowWindow(SW_SHOWMAXIMIZED) for a visible popup window */
877static const struct message WmShowVisMaxPopupSeq[] = {
890 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
891 { 0 }
892};
893/* CreateWindow (for a child popup window, not initially visible) */
894static const struct message WmCreateChildPopupSeq[] = {
895 { HCBT_CREATEWND, hook },
896 { WM_NCCREATE, sent },
897 { WM_NCCALCSIZE, sent|wparam, 0 },
898 { WM_CREATE, sent },
899 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
901 { WM_MOVE, sent },
902 { 0 }
903};
904/* CreateWindow (for a popup window, not initially visible,
905 * which sets WS_VISIBLE in WM_CREATE handler)
906 */
907static const struct message WmCreateInvisiblePopupSeq[] = {
908 { HCBT_CREATEWND, hook },
909 { WM_NCCREATE, sent },
910 { WM_NCCALCSIZE, sent|wparam, 0 },
911 { WM_CREATE, sent },
912 { WM_STYLECHANGING, sent },
913 { WM_STYLECHANGED, sent },
914 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
916 { WM_MOVE, sent },
917 { 0 }
918};
919/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
920 * for a popup window with WS_VISIBLE style set
921 */
922static const struct message WmShowVisiblePopupSeq_2[] = {
924 { 0 }
925};
926/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
927 * for a popup window with WS_VISIBLE style set
928 */
929static const struct message WmShowVisiblePopupSeq_3[] = {
931 { HCBT_ACTIVATE, hook },
932 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
935 { WM_NCACTIVATE, sent },
936 { WM_ACTIVATE, sent|wparam, 1 },
937 { HCBT_SETFOCUS, hook },
942 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
946 { 0 }
947};
948/* CreateWindow (for a popup window with WS_VISIBLE style set and extreme location)
949 */
950static const struct message WmShowPopupExtremeLocationSeq[] = {
951 { HCBT_CREATEWND, hook },
952 { WM_NCCREATE, sent },
953 { WM_NCCALCSIZE, sent|wparam, 0 },
954 { WM_CREATE, sent },
955 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
957 { WM_MOVE, sent },
958 { WM_SHOWWINDOW, sent|wparam, 1 },
960 { HCBT_ACTIVATE, hook },
963 { WM_ACTIVATEAPP, sent },
964 { WM_NCACTIVATE, sent },
965 { WM_ACTIVATE, sent },
969 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
970 { HCBT_SETFOCUS, hook },
972 { WM_NCPAINT, sent|wparam, 1 },
973 { WM_ERASEBKGND, sent },
975 /* occasionally received on test machines */
978 { 0 }
979};
980/* CreateWindow (for a popup window with WS_VISIBLE style set)
981 */
982static const struct message WmShowPopupFirstDrawSeq_1[] = {
983 { HCBT_CREATEWND, hook },
984 { WM_NCCREATE, sent },
985 { WM_NCCALCSIZE, sent|wparam, 0 },
986 { WM_CREATE, sent },
987 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
989 { WM_MOVE, sent },
990 { WM_SHOWWINDOW, sent|wparam, 1 },
992 { HCBT_ACTIVATE, hook },
995 { WM_ACTIVATEAPP, sent },
996 { WM_NCACTIVATE, sent },
997 { WM_ACTIVATE, sent },
1001 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1002 { HCBT_SETFOCUS, hook },
1004 { WM_NCPAINT, sent|wparam, 1 },
1005 { WM_ERASEBKGND, sent },
1007 { WM_PAINT, sent },
1008 /* occasionally received on test machines */
1011 { 0 }
1012};
1013/* CreateWindow (for a popup window that is shown with ShowWindow(SW_SHOWMAXIMIZED))
1014 */
1015static const struct message WmShowPopupFirstDrawSeq_2[] = {
1016 { HCBT_CREATEWND, hook },
1017 { WM_NCCREATE, sent },
1018 { WM_NCCALCSIZE, sent|wparam, 0 },
1019 { WM_CREATE, sent },
1020 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1022 { WM_MOVE, sent },
1027 { HCBT_ACTIVATE, hook },
1033 { WM_ACTIVATEAPP, sent },
1034 { WM_NCACTIVATE, sent },
1035 { WM_ACTIVATE, sent },
1039 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1040 { HCBT_SETFOCUS, hook },
1042 { WM_NCPAINT, sent|wparam, 1 },
1043 { WM_ERASEBKGND, sent },
1045 { WM_MOVE, sent|defwinproc },
1046 { WM_SIZE, sent|defwinproc, 0 },
1047 { WM_PAINT, sent},
1048 /* occasionally received on test machines */
1051 { 0 }
1052};
1053static const struct message WmFirstDrawSetWindowPosSeq1[] = {
1054 { HCBT_CREATEWND, hook },
1055 { WM_NCCREATE, sent },
1056 { WM_NCCALCSIZE, sent|wparam, 0 },
1057 { WM_CREATE, sent },
1058 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1060 { WM_MOVE, sent },
1062 { HCBT_ACTIVATE, hook },
1065 { WM_ACTIVATEAPP, sent },
1066 { WM_NCACTIVATE, sent },
1067 { WM_ACTIVATE, sent },
1071 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1072 { HCBT_SETFOCUS, hook },
1074 { WM_NCPAINT, sent|wparam, 1 },
1075 { WM_ERASEBKGND, sent },
1077 { WM_MOVE, sent|defwinproc },
1078 { 0 }
1079};
1080static const struct message WmFirstDrawSetWindowPosSeq2[] = {
1081 { HCBT_CREATEWND, hook },
1082 { WM_NCCREATE, sent },
1083 { WM_NCCALCSIZE, sent|wparam, 0 },
1084 { WM_CREATE, sent },
1085 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1087 { WM_MOVE, sent },
1089 { HCBT_ACTIVATE, hook },
1092 { WM_ACTIVATEAPP, sent },
1093 { WM_NCACTIVATE, sent },
1094 { WM_ACTIVATE, sent },
1098 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1099 { HCBT_SETFOCUS, hook },
1102 { WM_MOVE, sent|defwinproc },
1103 { 0 }
1104};
1105static const struct message WmFirstDrawSetWindowPosSeq3[] = {
1106 { HCBT_CREATEWND, hook },
1107 { WM_NCCREATE, sent },
1108 { WM_NCCALCSIZE, sent|wparam, 0 },
1109 { WM_CREATE, sent },
1110 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1112 { WM_MOVE, sent },
1114 /* Probably shouldn't happen, but not part of this test */
1121 { 0 }
1122};
1123static const struct message WmFirstDrawSetWindowPosSeq4[] = {
1124 { HCBT_CREATEWND, hook },
1125 { WM_NCCREATE, sent },
1126 { WM_NCCALCSIZE, sent|wparam, 0 },
1127 { WM_CREATE, sent },
1128 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1130 { WM_MOVE, sent },
1132 { HCBT_ACTIVATE, hook },
1135 { WM_ACTIVATEAPP, sent },
1136 { WM_NCACTIVATE, sent },
1137 { WM_ACTIVATE, sent },
1141 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1142 { HCBT_SETFOCUS, hook },
1144 { WM_NCPAINT, sent|wparam, 1 },
1145 { WM_ERASEBKGND, sent },
1147 { 0 }
1148};
1149static const struct message WmFirstDrawSetWindowPosSeq5[] = {
1150 { HCBT_CREATEWND, hook },
1151 { WM_NCCREATE, sent },
1152 { WM_NCCALCSIZE, sent|wparam, 0 },
1153 { WM_CREATE, sent },
1154 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1156 { WM_MOVE, sent },
1158 { HCBT_ACTIVATE, hook },
1161 { WM_ACTIVATEAPP, sent },
1162 { WM_NCACTIVATE, sent },
1163 { WM_ACTIVATE, sent },
1167 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1168 { HCBT_SETFOCUS, hook },
1171 { 0 }
1172};
1173static const struct message WmFirstDrawChildSeq1[] = {
1174 { 0 }
1175};
1176static const struct message WmFirstDrawChildSeq2[] = {
1177 { WM_NCPAINT, sent|wparam, 1 },
1178 { WM_ERASEBKGND, sent },
1179 /* occasionally received on test machines */
1182 { 0 }
1183};
1184/* CreateWindow (for child window, not initially visible) */
1185static const struct message WmCreateChildSeq[] = {
1186 { HCBT_CREATEWND, hook },
1187 { WM_NCCREATE, sent },
1188 /* child is inserted into parent's child list after WM_NCCREATE returns */
1189 { WM_NCCALCSIZE, sent|wparam, 0 },
1190 { WM_CREATE, sent },
1191 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1193 { WM_MOVE, sent },
1195 { 0 }
1196};
1197/* CreateWindow (for maximized child window, not initially visible) */
1198static const struct message WmCreateMaximizedChildSeq[] = {
1199 { HCBT_CREATEWND, hook },
1200 { WM_NCCREATE, sent },
1201 { WM_NCCALCSIZE, sent|wparam, 0 },
1202 { WM_CREATE, sent },
1203 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1205 { WM_MOVE, sent },
1209 { WM_NCCALCSIZE, sent|wparam, 1 },
1212 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1214 { 0 }
1215};
1216/* CreateWindow (for a child window, initially visible) */
1217static const struct message WmCreateVisibleChildSeq[] = {
1218 { HCBT_CREATEWND, hook },
1219 { WM_NCCREATE, sent },
1220 /* child is inserted into parent's child list after WM_NCCREATE returns */
1221 { WM_NCCALCSIZE, sent|wparam, 0 },
1222 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1223 { WM_CREATE, sent },
1224 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1226 { WM_MOVE, sent },
1228 { WM_SHOWWINDOW, sent|wparam, 1 },
1230 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1233 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* WinXP */
1234 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1235 { 0 }
1236};
1237/* ShowWindow(SW_SHOW) for a not visible child window */
1238static const struct message WmShowChildSeq[] = {
1239 { WM_SHOWWINDOW, sent|wparam, 1 },
1241 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1244 { 0 }
1245};
1246/* ShowWindow(SW_HIDE) for a visible child window */
1247static const struct message WmHideChildSeq[] = {
1248 { WM_SHOWWINDOW, sent|wparam, 0 },
1250 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1253 { 0 }
1254};
1255/* ShowWindow(SW_HIDE) for a visible child window checking all parent events*/
1256static const struct message WmHideChildSeq2[] = {
1257 { WM_SHOWWINDOW, sent|wparam, 0 },
1259 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1262 { 0 }
1263};
1264/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
1265 * for a not visible child window
1266 */
1267static const struct message WmShowChildSeq_2[] = {
1269 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1272 { 0 }
1273};
1274/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE)
1275 * for a not visible child window
1276 */
1277static const struct message WmShowChildSeq_3[] = {
1279 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1281 { 0 }
1282};
1283/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
1284 * for a visible child window with a caption
1285 */
1286static const struct message WmShowChildSeq_4[] = {
1289 { 0 }
1290};
1291/* ShowWindow(SW_MINIMIZE) for child with invisible parent */
1295 { WM_NCCALCSIZE, sent|wparam, 1 },
1296 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1299 { WM_MOVE, sent|defwinproc },
1301 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1302 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1303 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1306 { 0 }
1307};
1308/* repeated ShowWindow(SW_MINIMIZE) for child with invisible parent */
1311 { 0 }
1312};
1313/* ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1318 { WM_NCCALCSIZE, sent|wparam, 1 },
1319 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1323 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1324 { 0 }
1325};
1326/* repeated ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1329 { 0 }
1330};
1331/* ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1335 { WM_NCCALCSIZE, sent|wparam, 1 },
1336 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1339 { WM_MOVE, sent|defwinproc },
1341 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1342 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1343 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1346 { 0 }
1347};
1348/* repeated ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1351 { 0 }
1352};
1353/* ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1357 { WM_NCCALCSIZE, sent|wparam, 1 },
1358 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1360 { WM_MOVE, sent|defwinproc },
1362 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1363 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1364 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1367 { 0 }
1368};
1369/* repeated ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1372 { 0 }
1373};
1374/* ShowWindow(SW_SHOW) for child with invisible parent */
1376 { WM_SHOWWINDOW, sent|wparam, 1 },
1377 { 0 }
1378};
1379/* ShowWindow(SW_HIDE) for child with invisible parent */
1381 { WM_SHOWWINDOW, sent|wparam, 0 },
1382 { 0 }
1383};
1384/* SetWindowPos(SWP_SHOWWINDOW) for child with invisible parent */
1387 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1389 { 0 }
1390};
1391/* SetWindowPos(SWP_HIDEWINDOW) for child with invisible parent */
1394 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1396 { 0 }
1397};
1398/* DestroyWindow for a visible child window */
1399static const struct message WmDestroyChildSeq[] = {
1400 { HCBT_DESTROYWND, hook },
1401 { 0x0090, sent|optional },
1403 { WM_SHOWWINDOW, sent|wparam, 0 },
1405 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1408 { HCBT_SETFOCUS, hook }, /* set focus to a parent */
1409 { WM_KILLFOCUS, sent },
1412 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1413 { WM_SETFOCUS, sent|parent },
1414 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1415 { WM_DESTROY, sent },
1416 { WM_DESTROY, sent|optional }, /* some other (IME?) window */
1417 { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */
1418 { WM_NCDESTROY, sent },
1419 { 0 }
1420};
1421/* visible child window destroyed by thread exit */
1422static const struct message WmExitThreadSeq[] = {
1423 { WM_NCDESTROY, sent }, /* actually in grandchild */
1424 { WM_PAINT, sent|parent },
1426 { 0 }
1427};
1428/* DestroyWindow for a visible child window with invisible parent */
1429static const struct message WmDestroyInvisibleChildSeq[] = {
1430 { HCBT_DESTROYWND, hook },
1431 { 0x0090, sent|optional },
1433 { WM_SHOWWINDOW, sent|wparam, 0 },
1434 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1435 { WM_DESTROY, sent },
1436 { WM_NCDESTROY, sent },
1437 { 0 }
1438};
1439/* Resizing child window with MoveWindow (32) */
1442 { WM_NCCALCSIZE, sent|wparam, 1 },
1446 { WM_MOVE, sent|defwinproc },
1448 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1449 { 0 }
1450};
1451/* Creation of a custom dialog (32) */
1452static const struct message WmCreateCustomDialogSeq[] = {
1453 { HCBT_CREATEWND, hook },
1455 { WM_NCCREATE, sent },
1456 { WM_NCCALCSIZE, sent|wparam, 0 },
1457 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1458 { WM_CREATE, sent },
1459 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1460 { WM_NOTIFYFORMAT, sent|optional },
1461 { WM_QUERYUISTATE, sent|optional },
1466 { WM_SHOWWINDOW, sent|wparam, 1 },
1468 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1469 { HCBT_ACTIVATE, hook },
1470 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1471
1472
1474
1476
1477 { WM_NCACTIVATE, sent },
1481 { EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
1482 { WM_ACTIVATE, sent|wparam, 1 },
1488 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1489 { WM_SETFOCUS, sent },
1491 { WM_NCPAINT, sent|wparam, 1 },
1494 { WM_ERASEBKGND, sent },
1505 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1507 { WM_MOVE, sent },
1508 { 0 }
1509};
1510/* Calling EndDialog for a custom dialog (32) */
1511static const struct message WmEndCustomDialogSeq[] = {
1513 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1516 { HCBT_ACTIVATE, hook },
1517 { WM_NCACTIVATE, sent|wparam, 0 },
1520 { WM_ACTIVATE, sent|wparam, 0 },
1521 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1526 { HCBT_SETFOCUS, hook },
1527 { WM_KILLFOCUS, sent },
1531 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1533 { 0 }
1534};
1535/* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
1536static const struct message WmShowCustomDialogSeq[] = {
1537 { WM_SHOWWINDOW, sent|wparam, 1 },
1539 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1540 { HCBT_ACTIVATE, hook },
1541 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1542
1544
1547 { WM_NCACTIVATE, sent },
1548 { WM_ACTIVATE, sent|wparam, 1 },
1550
1555 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1556 { WM_SETFOCUS, sent },
1558 { WM_NCPAINT, sent|wparam, 1 },
1559 { WM_ERASEBKGND, sent },
1562 { 0 }
1563};
1564/* Creation and destruction of a modal dialog (32) */
1565static const struct message WmModalDialogSeq[] = {
1567 { HCBT_SETFOCUS, hook },
1568 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1571 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1572 { WM_ENABLE, sent|parent|wparam, 0 },
1573 { HCBT_CREATEWND, hook },
1574 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1575 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1576 { WM_SETFONT, sent },
1577 { WM_INITDIALOG, sent },
1578 { WM_CHANGEUISTATE, sent|optional },
1579 { WM_UPDATEUISTATE, sent|optional },
1580 { WM_SHOWWINDOW, sent },
1581 { HCBT_ACTIVATE, hook },
1582 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1585 { WM_NCACTIVATE, sent },
1587 { WM_ACTIVATE, sent|wparam, 1 },
1589 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1601 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1602 { WM_PAINT, sent|optional },
1625 { WM_TIMER, sent },
1626 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1627 { WM_ENABLE, sent|parent|wparam, 1 },
1629 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1632 { HCBT_ACTIVATE, hook },
1633 { WM_NCACTIVATE, sent|wparam, 0 },
1635 { WM_ACTIVATE, sent|wparam, 0 },
1636 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1639 { HCBT_SETFOCUS, hook },
1641 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1643 { EVENT_SYSTEM_DIALOGEND, winevent_hook|wparam|lparam, 0, 0 },
1644 { HCBT_DESTROYWND, hook },
1645 { 0x0090, sent|optional },
1646 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1647 { WM_DESTROY, sent },
1648 { WM_NCDESTROY, sent },
1649 { 0 }
1650};
1651static const struct message WmModalDialogSeq_2[] = {
1652 { WM_CANCELMODE, sent },
1653 { HCBT_SETFOCUS, hook },
1654 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1655 { WM_KILLFOCUS, sent },
1657 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1658 { WM_ENABLE, sent|wparam, 0 },
1659 { HCBT_CREATEWND, hook },
1660 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1661 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1662 { WM_SETFONT, sent },
1663 { WM_INITDIALOG, sent },
1664 { WM_CHANGEUISTATE, sent|optional },
1665 { WM_UPDATEUISTATE, sent|optional },
1666 { WM_ENABLE, sent|wparam, 1 },
1668 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1669 { WM_CHANGEUISTATE, sent|optional },
1670 { WM_UPDATEUISTATE, sent|optional },
1671 { HCBT_DESTROYWND, hook },
1672 { 0x0090, sent|optional },
1673 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1674 { WM_DESTROY, sent },
1675 { WM_NCDESTROY, sent },
1676 { 0 }
1677};
1678/* SetMenu for NonVisible windows with size change*/
1681 { WM_NCCALCSIZE, sent|wparam, 1 },
1682 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1684 { WM_MOVE, sent|defwinproc },
1686 { WM_NCCALCSIZE,sent|wparam|optional, 1 }, /* XP */
1687 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1688 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1691 { 0 }
1692};
1693/* SetMenu for NonVisible windows with no size change */
1696 { WM_NCCALCSIZE, sent|wparam, 1 },
1698 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1699 { 0 }
1700};
1701/* SetMenu for Visible windows with size change */
1704 { WM_NCCALCSIZE, sent|wparam, 1 },
1705 { 0x0093, sent|defwinproc|optional },
1706 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1707 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1708 { 0x0093, sent|defwinproc|optional },
1709 { 0x0093, sent|defwinproc|optional },
1710 { 0x0091, sent|defwinproc|optional },
1711 { 0x0092, sent|defwinproc|optional },
1716 { WM_MOVE, sent|defwinproc },
1718 { 0x0093, sent|optional },
1720 { 0x0093, sent|defwinproc|optional },
1721 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1722 { 0x0093, sent|defwinproc|optional },
1723 { 0x0093, sent|defwinproc|optional },
1724 { 0x0091, sent|defwinproc|optional },
1725 { 0x0092, sent|defwinproc|optional },
1727 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1728 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1729 { 0 }
1730};
1731/* SetMenu for Visible windows with no size change */
1734 { WM_NCCALCSIZE, sent|wparam, 1 },
1735 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1740 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1741 { 0 }
1742};
1743/* DrawMenuBar for a visible window */
1744static const struct message WmDrawMenuBarSeq[] =
1745{
1747 { WM_NCCALCSIZE, sent|wparam, 1 },
1748 { 0x0093, sent|defwinproc|optional },
1749 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1750 { 0x0093, sent|defwinproc|optional },
1751 { 0x0093, sent|defwinproc|optional },
1752 { 0x0091, sent|defwinproc|optional },
1753 { 0x0092, sent|defwinproc|optional },
1757 { 0x0093, sent|optional },
1758 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1759 { 0 }
1760};
1761
1762static const struct message WmSetRedrawFalseSeq[] =
1763{
1764 { WM_SETREDRAW, sent|wparam, 0 },
1765 { 0 }
1766};
1767
1768static const struct message WmSetRedrawTrueSeq[] =
1769{
1770 { WM_SETREDRAW, sent|wparam, 1 },
1771 { 0 }
1772};
1773
1774static const struct message WmEnableWindowSeq_1[] =
1775{
1776 { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
1777 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1780 { WM_ENABLE, sent|wparam|lparam, FALSE, 0 },
1781 { 0 }
1782};
1783
1784static const struct message WmEnableWindowSeq_2[] =
1785{
1786 { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
1787 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1788 { 0 }
1789};
1790
1791static const struct message WmEnableWindowSeq_3[] =
1792{
1793 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1794 { WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
1795 { 0 }
1796};
1797
1798static const struct message WmEnableWindowSeq_4[] =
1799{
1800 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1801 { 0 }
1802};
1803
1804static const struct message WmGetScrollRangeSeq[] =
1805{
1806 { SBM_GETRANGE, sent },
1807 { 0 }
1808};
1809static const struct message WmGetScrollInfoSeq[] =
1810{
1811 { SBM_GETSCROLLINFO, sent },
1812 { 0 }
1813};
1814static const struct message WmSetScrollRangeSeq[] =
1815{
1816 /* MSDN claims that Windows sends SBM_SETRANGE message, but win2k SP4
1817 sends SBM_SETSCROLLINFO.
1818 */
1819 { SBM_SETSCROLLINFO, sent },
1820 { 0 }
1821};
1822/* SetScrollRange for a window without a non-client area */
1824{
1825 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_HSCROLL, 0 },
1826 { 0 }
1827};
1829{
1830 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_VSCROLL, 0 },
1831 { 0 }
1832};
1833static const struct message WmSetScrollRangeHVSeq[] =
1834{
1836 { WM_NCCALCSIZE, sent|wparam, 1 },
1840 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1841 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1842 { 0 }
1843};
1844/* SetScrollRange for a window with a non-client area */
1845static const struct message WmSetScrollRangeHV_NC_Seq[] =
1846{
1848 { WM_NCCALCSIZE, sent|wparam, 1 },
1849 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1851 { WM_STYLECHANGING, sent|defwinproc|optional },
1852 { WM_STYLECHANGED, sent|defwinproc|optional },
1853 { WM_STYLECHANGING, sent|defwinproc|optional },
1854 { WM_STYLECHANGED, sent|defwinproc|optional },
1855 { WM_STYLECHANGING, sent|defwinproc|optional },
1856 { WM_STYLECHANGED, sent|defwinproc|optional },
1857 { WM_STYLECHANGING, sent|defwinproc|optional },
1858 { WM_STYLECHANGED, sent|defwinproc|optional },
1862 { WM_CTLCOLORDLG, sent|defwinproc|optional }, /* sent to a parent of the dialog */
1865 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1866 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1871 { 0 }
1872};
1873/* test if we receive the right sequence of messages */
1874/* after calling ShowWindow( SW_SHOWNA) */
1875static const struct message WmSHOWNAChildInvisParInvis[] = {
1876 { WM_SHOWWINDOW, sent|wparam, 1 },
1877 { 0 }
1878};
1879static const struct message WmSHOWNAChildVisParInvis[] = {
1880 { WM_SHOWWINDOW, sent|wparam, 1 },
1881 { 0 }
1882};
1883static const struct message WmSHOWNAChildVisParVis[] = {
1884 { WM_SHOWWINDOW, sent|wparam, 1 },
1886 { 0 }
1887};
1888static const struct message WmSHOWNAChildInvisParVis[] = {
1889 { WM_SHOWWINDOW, sent|wparam, 1 },
1891 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1894 { 0 }
1895};
1896static const struct message WmSHOWNATopVisible[] = {
1897 { WM_SHOWWINDOW, sent|wparam, 1 },
1903 { 0 }
1904};
1905static const struct message WmSHOWNATopInvisible[] = {
1906 { WM_NOTIFYFORMAT, sent|optional },
1907 { WM_QUERYUISTATE, sent|optional },
1912 { WM_SHOWWINDOW, sent|wparam, 1 },
1914 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1922 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1924 { WM_MOVE, sent },
1925 { 0 }
1926};
1927
1928static const struct message WmTrackPopupMenu[] = {
1929 { HCBT_CREATEWND, hook },
1931 { WM_INITMENU, sent|lparam, 0, 0 },
1932 { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
1933 { 0x0093, sent|optional },
1934 { 0x0094, sent|optional },
1935 { 0x0094, sent|optional },
1936 { WM_ENTERIDLE, sent|wparam, 2 },
1938 { HCBT_DESTROYWND, hook },
1939 { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
1940 { WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 },
1941 { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
1942 { 0 }
1943};
1944
1945static const struct message WmTrackPopupMenuEsc[] = {
1946 { 0 }
1947};
1948
1949static const struct message WmTrackPopupMenuCapture[] = {
1950 { HCBT_CREATEWND, hook },
1953 { WM_INITMENU, sent|lparam, 0, 0 },
1954 { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
1955 { 0x0093, sent|optional },
1956 { 0x0094, sent|optional },
1957 { 0x0094, sent|optional },
1958 { WM_ENTERIDLE, sent|wparam, 2 },
1960 { HCBT_DESTROYWND, hook },
1961 { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
1962 { WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 },
1963 { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
1964 { 0 }
1965};
1966
1967static const struct message WmTrackPopupMenuEmpty[] = {
1968 { HCBT_CREATEWND, hook },
1970 { WM_INITMENU, sent|lparam, 0, 0 },
1971 { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
1972 { 0x0093, sent|optional },
1973 { 0x0094, sent|optional },
1974 { 0x0094, sent|optional },
1976 { WM_EXITMENULOOP,