[USER32_WINETEST]
[reactos.git] / rostests / winetests / user32 / msg.c
1 /*
2 * Unit tests for window message handling
3 *
4 * Copyright 1999 Ove Kaaven
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2004, 2005 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 //#define _WIN32_WINNT 0x0600 /* For WM_CHANGEUISTATE,QS_RAWINPUT,WM_DWMxxxx */
24 //#define WINVER 0x0600 /* for WM_GETTITLEBARINFOEX */
25
26 #include <assert.h>
27 #include <stdarg.h>
28 #include <stdio.h>
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "winnls.h"
35
36 #include "wine/test.h"
37
38 #define MDI_FIRST_CHILD_ID 2004
39
40 /* undocumented SWP flags - from SDK 3.1 */
41 #define SWP_NOCLIENTSIZE 0x0800
42 #define SWP_NOCLIENTMOVE 0x1000
43 #define SWP_STATECHANGED 0x8000
44
45 #define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */
46
47 #ifndef WM_KEYF1
48 #define WM_KEYF1 0x004d
49 #endif
50
51 #ifndef WM_SYSTIMER
52 #define WM_SYSTIMER 0x0118
53 #endif
54
55 #define WND_PARENT_ID 1
56 #define WND_POPUP_ID 2
57 #define WND_CHILD_ID 3
58
59 #ifndef WM_LBTRACKPOINT
60 #define WM_LBTRACKPOINT 0x0131
61 #endif
62
63 /* encoded DRAWITEMSTRUCT into an LPARAM */
64 typedef struct
65 {
66 union
67 {
68 struct
69 {
70 UINT type : 4; /* ODT_* flags */
71 UINT ctl_id : 4; /* Control ID */
72 UINT item_id : 4; /* Menu item ID */
73 UINT action : 4; /* ODA_* flags */
74 UINT state : 16; /* ODS_* flags */
75 } item;
76 LPARAM lp;
77 } u;
78 } DRAW_ITEM_STRUCT;
79
80 static BOOL test_DestroyWindow_flag;
81 static HWINEVENTHOOK hEvent_hook;
82 static HHOOK hKBD_hook;
83 static HHOOK hCBT_hook;
84 static DWORD cbt_hook_thread_id;
85
86 static const WCHAR testWindowClassW[] =
87 { 'T','e','s','t','W','i','n','d','o','w','C','l','a','s','s','W',0 };
88
89 /*
90 FIXME: add tests for these
91 Window Edge Styles (Win31/Win95/98 look), in order of precedence:
92 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
93 WS_THICKFRAME: thick border
94 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
95 WS_BORDER (default for overlapped windows): single black border
96 none (default for child (and popup?) windows): no border
97 */
98
99 typedef enum {
100 sent=0x1,
101 posted=0x2,
102 parent=0x4,
103 wparam=0x8,
104 lparam=0x10,
105 defwinproc=0x20,
106 beginpaint=0x40,
107 optional=0x80,
108 hook=0x100,
109 winevent_hook=0x200,
110 kbd_hook=0x400
111 } msg_flags_t;
112
113 struct message {
114 UINT message; /* the WM_* code */
115 msg_flags_t flags; /* message props */
116 WPARAM wParam; /* expected value of wParam */
117 LPARAM lParam; /* expected value of lParam */
118 WPARAM wp_mask; /* mask for wParam checks */
119 LPARAM lp_mask; /* mask for lParam checks */
120 };
121
122 struct recvd_message {
123 UINT message; /* the WM_* code */
124 msg_flags_t flags; /* message props */
125 HWND hwnd; /* window that received the message */
126 WPARAM wParam; /* expected value of wParam */
127 LPARAM lParam; /* expected value of lParam */
128 int line; /* source line where logged */
129 const char *descr; /* description for trace output */
130 char output[512]; /* trace output */
131 };
132
133 /* Empty message sequence */
134 static const struct message WmEmptySeq[] =
135 {
136 { 0 }
137 };
138 /* CreateWindow (for overlapped window, not initially visible) (16/32) */
139 static const struct message WmCreateOverlappedSeq[] = {
140 { HCBT_CREATEWND, hook },
141 { WM_GETMINMAXINFO, sent },
142 { WM_NCCREATE, sent },
143 { WM_NCCALCSIZE, sent|wparam, 0 },
144 { 0x0093, sent|defwinproc|optional },
145 { 0x0094, sent|defwinproc|optional },
146 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
147 { WM_CREATE, sent },
148 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
149 { 0 }
150 };
151 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
152 * for a not visible overlapped window.
153 */
154 static const struct message WmSWP_ShowOverlappedSeq[] = {
155 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
156 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
157 { WM_NCPAINT, sent|wparam|optional, 1 },
158 { WM_GETTEXT, sent|defwinproc|optional },
159 { WM_ERASEBKGND, sent|optional },
160 { HCBT_ACTIVATE, hook },
161 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
162 { WM_NOTIFYFORMAT, sent|optional },
163 { WM_QUERYUISTATE, sent|optional },
164 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
165 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x: SWP_NOSENDCHANGING */
166 { WM_ACTIVATEAPP, sent|wparam, 1 },
167 { WM_NCACTIVATE, sent },
168 { WM_GETTEXT, sent|defwinproc|optional },
169 { WM_ACTIVATE, sent|wparam, 1 },
170 { HCBT_SETFOCUS, hook },
171 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
172 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
173 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
174 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
175 { WM_GETTEXT, sent|optional },
176 { WM_NCPAINT, sent|wparam|optional, 1 },
177 { WM_GETTEXT, sent|defwinproc|optional },
178 { WM_ERASEBKGND, sent|optional },
179 /* Win9x adds SWP_NOZORDER below */
180 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
181 { WM_GETTEXT, sent|optional },
182 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
183 { WM_NCPAINT, sent|wparam|optional, 1 },
184 { WM_ERASEBKGND, sent|optional },
185 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
186 { WM_SYNCPAINT, sent|optional },
187 { WM_GETTITLEBARINFOEX, sent|optional },
188 { WM_PAINT, sent|optional },
189 { WM_NCPAINT, sent|beginpaint|optional },
190 { WM_GETTEXT, sent|beginpaint|defwinproc|optional },
191 { WM_ERASEBKGND, sent|beginpaint|optional },
192 { 0 }
193 };
194 /* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE)
195 * for a visible overlapped window.
196 */
197 static const struct message WmSWP_HideOverlappedSeq[] = {
198 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE },
199 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
200 { HCBT_ACTIVATE, hook|optional },
201 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
202 { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
203 { WM_NCACTIVATE, sent|optional },
204 { WM_ACTIVATE, sent|optional },
205 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
206 { 0 }
207 };
208
209 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
210 * for a visible overlapped window.
211 */
212 static const struct message WmSWP_ResizeSeq[] = {
213 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE },
214 { WM_GETMINMAXINFO, sent|defwinproc },
215 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
216 { WM_NCPAINT, sent|optional },
217 { WM_GETTEXT, sent|defwinproc|optional },
218 { WM_ERASEBKGND, sent|optional },
219 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
220 { WM_SIZE, sent|defwinproc|optional },
221 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
222 { WM_NCPAINT, sent|optional },
223 { WM_GETTEXT, sent|defwinproc|optional },
224 { WM_ERASEBKGND, sent|optional },
225 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
226 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
227 { 0 }
228 };
229
230 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE)
231 * for a visible popup window.
232 */
233 static const struct message WmSWP_ResizePopupSeq[] = {
234 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOMOVE },
235 { WM_GETMINMAXINFO, sent|defwinproc|optional }, /* Win9x */
236 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
237 { WM_NCPAINT, sent|optional },
238 { WM_GETTEXT, sent|defwinproc|optional },
239 { WM_ERASEBKGND, sent|optional },
240 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOCLIENTMOVE },
241 { WM_SIZE, sent|defwinproc|wparam|optional, SIZE_RESTORED },
242 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
243 { WM_NCPAINT, sent|optional },
244 { WM_GETTEXT, sent|defwinproc|optional },
245 { WM_ERASEBKGND, sent|optional },
246 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
247 { 0 }
248 };
249
250 /* SetWindowPos(SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE)
251 * for a visible overlapped window.
252 */
253 static const struct message WmSWP_MoveSeq[] = {
254 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_NOSIZE },
255 { WM_NCPAINT, sent|optional },
256 { WM_GETTEXT, sent|defwinproc|optional },
257 { WM_ERASEBKGND, sent|optional },
258 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCLIENTSIZE },
259 { WM_MOVE, sent|defwinproc|wparam, 0 },
260 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
261 { 0 }
262 };
263 /* Resize with SetWindowPos(SWP_NOZORDER)
264 * for a visible overlapped window
265 * SWP_NOZORDER is stripped by the logging code
266 */
267 static const struct message WmSWP_ResizeNoZOrder[] = {
268 { WM_WINDOWPOSCHANGING, sent|wparam, /*SWP_NOZORDER|*/SWP_NOACTIVATE },
269 { WM_GETMINMAXINFO, sent|defwinproc },
270 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
271 { WM_NCPAINT, sent|optional },
272 { WM_GETTEXT, sent|defwinproc|optional },
273 { WM_ERASEBKGND, sent|optional },
274 { WM_WINDOWPOSCHANGED, sent|wparam|optional, /*SWP_NOZORDER|*/SWP_NOACTIVATE, 0,
275 SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE },
276 { WM_MOVE, sent|defwinproc|optional },
277 { WM_SIZE, sent|defwinproc|optional },
278 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
279 { WM_NCPAINT, sent|optional }, /* Win9x doesn't send it */
280 { WM_GETTEXT, sent|defwinproc|optional }, /* Win9x doesn't send it */
281 { WM_ERASEBKGND, sent|optional }, /* Win9x doesn't send it */
282 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
283 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
284 { 0 }
285 };
286
287 /* Switch visible mdi children */
288 static const struct message WmSwitchChild[] = {
289 /* Switch MDI child */
290 { WM_MDIACTIVATE, sent },/* in the MDI client */
291 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 1st MDI child */
292 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
293 { WM_CHILDACTIVATE, sent },/* in the 1st MDI child */
294 /* Deactivate 2nd MDI child */
295 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
296 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
297 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
298 /* Preparing for maximize and maximize the 1st MDI child */
299 { WM_GETMINMAXINFO, sent|defwinproc }, /* in the 1st MDI child */
300 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_STATECHANGED }, /* in the 1st MDI child */
301 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
302 { WM_CHILDACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
303 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED }, /* in the 1st MDI child */
304 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED }, /* in the 1st MDI child */
305 /* Lock redraw 2nd MDI child */
306 { WM_SETREDRAW, sent|wparam|defwinproc, 0 }, /* in the 2nd MDI child */
307 { HCBT_MINMAX, hook|lparam, 0, SW_NORMALNA },
308 /* Restore 2nd MDI child */
309 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },/* in the 2nd MDI child */
310 { WM_NCCALCSIZE, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
311 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
312 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_STATECHANGED }, /* in the 2nd MDI child */
313 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED }, /* in the 2nd MDI child */
314 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 2nd MDI child */
315 /* Redraw 2nd MDI child */
316 { WM_SETREDRAW, sent|wparam|defwinproc, 1 },/* in the 2nd MDI child */
317 /* Redraw MDI frame */
318 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE },/* in MDI frame */
319 { WM_NCCALCSIZE, sent|wparam, 1 },/* in MDI frame */
320 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE}, /* in MDI frame */
321 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in MDI frame */
322 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* in the 1st MDI child */
323 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, /* in the 1st MDI child */
324 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 1st MDI child */
325 { HCBT_SETFOCUS, hook },
326 { WM_KILLFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
327 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 },/* in the 1st MDI child */
328 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
329 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
330 { WM_SETFOCUS, sent },/* in the MDI client */
331 { HCBT_SETFOCUS, hook },
332 { WM_KILLFOCUS, sent },/* in the MDI client */
333 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
334 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, /* in the 1st MDI child */
335 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
336 { WM_SETFOCUS, sent|defwinproc }, /* in the 1st MDI child */
337 { WM_MDIACTIVATE, sent|defwinproc },/* in the 1st MDI child */
338 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, /* in the 1st MDI child */
339 { 0 }
340 };
341
342 /* Switch visible not maximized mdi children */
343 static const struct message WmSwitchNotMaximizedChild[] = {
344 /* Switch not maximized MDI child */
345 { WM_MDIACTIVATE, sent },/* in the MDI client */
346 { WM_WINDOWPOSCHANGING, sent|wparam,SWP_NOSIZE|SWP_NOMOVE },/* in the 2nd MDI child */
347 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
348 { WM_CHILDACTIVATE, sent },/* in the 2nd MDI child */
349 /* Deactivate 1st MDI child */
350 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
351 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
352 /* Activate 2nd MDI child */
353 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE}, /* in the 2nd MDI child */
354 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, /* in the 2nd MDI child */
355 { HCBT_SETFOCUS, hook }, /* in the 1st MDI child */
356 { WM_KILLFOCUS, sent|defwinproc }, /* in the 1st MDI child */
357 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
358 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
359 { WM_SETFOCUS, sent, 0 }, /* in the MDI client */
360 { HCBT_SETFOCUS, hook },
361 { WM_KILLFOCUS, sent }, /* in the MDI client */
362 { WM_IME_SETCONTEXT, sent|optional }, /* in the MDI client */
363 { WM_IME_SETCONTEXT, sent|defwinproc|optional }, /* in the 1st MDI child */
364 { WM_SETFOCUS, sent|defwinproc }, /* in the 2nd MDI child */
365 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 2nd MDI child */
366 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE}, /* in the 2nd MDI child */
367 { 0 }
368 };
369
370
371 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
372 SWP_NOZORDER|SWP_FRAMECHANGED)
373 * for a visible overlapped window with WS_CLIPCHILDREN style set.
374 */
375 static const struct message WmSWP_FrameChanged_clip[] = {
376 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
377 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
378 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
379 { WM_GETTEXT, sent|parent|defwinproc|optional },
380 { WM_ERASEBKGND, sent|parent|optional }, /* FIXME: remove optional once Wine is fixed */
381 { WM_NCPAINT, sent }, /* wparam != 1 */
382 { WM_ERASEBKGND, sent },
383 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
384 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
385 { WM_PAINT, sent },
386 { 0 }
387 };
388 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|
389 SWP_NOZORDER|SWP_FRAMECHANGED)
390 * for a visible overlapped window.
391 */
392 static const struct message WmSWP_FrameChangedDeferErase[] = {
393 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
394 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
395 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_DEFERERASE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
396 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
397 { WM_PAINT, sent|parent|optional },
398 { WM_NCPAINT, sent|beginpaint|parent|optional }, /* wparam != 1 */
399 { WM_GETTEXT, sent|beginpaint|parent|defwinproc|optional },
400 { WM_PAINT, sent },
401 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
402 { WM_ERASEBKGND, sent|beginpaint|optional },
403 { 0 }
404 };
405
406 /* SetWindowPos(SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|
407 SWP_NOZORDER|SWP_FRAMECHANGED)
408 * for a visible overlapped window without WS_CLIPCHILDREN style set.
409 */
410 static const struct message WmSWP_FrameChanged_noclip[] = {
411 { WM_WINDOWPOSCHANGING, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED },
412 { WM_NCCALCSIZE, sent|wparam|parent, 1 },
413 { WM_NCPAINT, sent|parent|optional }, /* wparam != 1 */
414 { WM_GETTEXT, sent|parent|defwinproc|optional },
415 { WM_ERASEBKGND, sent|parent|optional },
416 { WM_WINDOWPOSCHANGED, sent|wparam|parent, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
417 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
418 { WM_PAINT, sent },
419 { WM_NCPAINT, sent|beginpaint }, /* wparam != 1 */
420 { WM_ERASEBKGND, sent|beginpaint|optional },
421 { 0 }
422 };
423
424 /* ShowWindow(SW_SHOW) for a not visible overlapped window */
425 static const struct message WmShowOverlappedSeq[] = {
426 { WM_SHOWWINDOW, sent|wparam, 1 },
427 { WM_NCPAINT, sent|wparam|optional, 1 },
428 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
429 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
430 { WM_NCPAINT, sent|wparam|optional, 1 },
431 { WM_GETTEXT, sent|defwinproc|optional },
432 { WM_ERASEBKGND, sent|optional },
433 { HCBT_ACTIVATE, hook },
434 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
435 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
436 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
437 { WM_NCPAINT, sent|wparam|optional, 1 },
438 { WM_ACTIVATEAPP, sent|wparam, 1 },
439 { WM_NCACTIVATE, sent|wparam, 1 },
440 { WM_GETTEXT, sent|defwinproc|optional },
441 { WM_ACTIVATE, sent|wparam, 1 },
442 { HCBT_SETFOCUS, hook },
443 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
444 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
445 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
446 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
447 { WM_GETTEXT, sent|optional },
448 { WM_NCPAINT, sent|wparam|optional, 1 },
449 { WM_GETTEXT, sent|defwinproc|optional },
450 { WM_ERASEBKGND, sent|optional },
451 /* Win9x adds SWP_NOZORDER below */
452 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
453 { WM_NCCALCSIZE, sent|optional },
454 { WM_GETTEXT, sent|optional },
455 { WM_NCPAINT, sent|optional },
456 { WM_ERASEBKGND, sent|optional },
457 { WM_SYNCPAINT, sent|optional },
458 #if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE
459 * messages. Does that mean that CreateWindow doesn't set initial
460 * window dimensions for overlapped windows?
461 */
462 { WM_SIZE, sent },
463 { WM_MOVE, sent },
464 #endif
465 { WM_PAINT, sent|optional },
466 { WM_NCPAINT, sent|beginpaint|optional },
467 { 0 }
468 };
469 /* ShowWindow(SW_SHOWMAXIMIZED) for a not visible overlapped window */
470 static const struct message WmShowMaxOverlappedSeq[] = {
471 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
472 { WM_GETMINMAXINFO, sent },
473 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
474 { WM_GETMINMAXINFO, sent|defwinproc },
475 { WM_NCCALCSIZE, sent|wparam, TRUE },
476 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
477 { HCBT_ACTIVATE, hook },
478 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
479 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
480 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
481 { WM_ACTIVATEAPP, sent|wparam, 1 },
482 { WM_NCACTIVATE, sent|wparam, 1 },
483 { WM_GETTEXT, sent|defwinproc|optional },
484 { WM_ACTIVATE, sent|wparam, 1 },
485 { HCBT_SETFOCUS, hook },
486 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
487 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
488 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
489 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
490 { WM_GETTEXT, sent|optional },
491 { WM_NCPAINT, sent|wparam|optional, 1 },
492 { WM_GETTEXT, sent|defwinproc|optional },
493 { WM_ERASEBKGND, sent|optional },
494 /* Win9x adds SWP_NOZORDER below */
495 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
496 { WM_MOVE, sent|defwinproc },
497 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
498 { WM_GETTEXT, sent|optional },
499 { WM_NCCALCSIZE, sent|optional },
500 { WM_NCPAINT, sent|optional },
501 { WM_ERASEBKGND, sent|optional },
502 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
503 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
504 { WM_SYNCPAINT, sent|optional },
505 { WM_GETTITLEBARINFOEX, sent|optional },
506 { WM_PAINT, sent|optional },
507 { WM_NCPAINT, sent|beginpaint|optional },
508 { WM_ERASEBKGND, sent|beginpaint|optional },
509 { 0 }
510 };
511 /* ShowWindow(SW_RESTORE) for a not visible maximized overlapped window */
512 static const struct message WmShowRestoreMaxOverlappedSeq[] = {
513 { HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
514 { WM_GETTEXT, sent|optional },
515 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
516 { WM_GETMINMAXINFO, sent|defwinproc },
517 { WM_NCCALCSIZE, sent|wparam, TRUE },
518 { WM_NCPAINT, sent|optional },
519 { WM_GETTEXT, sent|defwinproc|optional },
520 { WM_ERASEBKGND, sent|optional },
521 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED, 0, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOMOVE },
522 { WM_MOVE, sent|defwinproc|optional },
523 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
524 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
525 { WM_NCPAINT, sent|optional },
526 { WM_ERASEBKGND, sent|optional },
527 { WM_PAINT, sent|optional },
528 { WM_GETTITLEBARINFOEX, sent|optional },
529 { WM_NCPAINT, sent|beginpaint|optional },
530 { WM_ERASEBKGND, sent|beginpaint|optional },
531 { 0 }
532 };
533 /* ShowWindow(SW_RESTORE) for a not visible minimized overlapped window */
534 static const struct message WmShowRestoreMinOverlappedSeq[] = {
535 { HCBT_MINMAX, hook|lparam, 0, SW_RESTORE },
536 { WM_QUERYOPEN, sent|optional },
537 { WM_GETTEXT, sent|optional },
538 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS },
539 { WM_GETMINMAXINFO, sent|defwinproc },
540 { WM_NCCALCSIZE, sent|wparam, TRUE },
541 { HCBT_ACTIVATE, hook },
542 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
543 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
544 { WM_ACTIVATEAPP, sent|wparam, 1 },
545 { WM_NCACTIVATE, sent|wparam, 1 },
546 { WM_GETTEXT, sent|defwinproc|optional },
547 { WM_ACTIVATE, sent|wparam, 1 },
548 { HCBT_SETFOCUS, hook },
549 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
550 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
551 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
552 { WM_GETTEXT, sent|optional },
553 { WM_NCPAINT, sent|wparam|optional, 1 },
554 { WM_GETTEXT, sent|defwinproc|optional },
555 { WM_ERASEBKGND, sent },
556 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_STATECHANGED|SWP_FRAMECHANGED|SWP_NOCOPYBITS },
557 { WM_MOVE, sent|defwinproc },
558 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
559 { WM_NCCALCSIZE, sent|wparam|optional, TRUE },
560 { WM_NCPAINT, sent|wparam|optional, 1 },
561 { WM_ERASEBKGND, sent|optional },
562 { WM_ACTIVATE, sent|wparam, 1 },
563 { WM_GETTEXT, sent|optional },
564 { WM_PAINT, sent|optional },
565 { WM_GETTITLEBARINFOEX, sent|optional },
566 { WM_NCPAINT, sent|beginpaint|optional },
567 { WM_ERASEBKGND, sent|beginpaint|optional },
568 { 0 }
569 };
570 /* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */
571 static const struct message WmShowMinOverlappedSeq[] = {
572 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
573 { HCBT_SETFOCUS, hook },
574 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
575 { WM_KILLFOCUS, sent },
576 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
577 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
578 { WM_GETTEXT, sent|optional },
579 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOCOPYBITS|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
580 { WM_GETMINMAXINFO, sent|defwinproc },
581 { WM_NCCALCSIZE, sent|wparam, TRUE },
582 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
583 { WM_NCPAINT, sent|optional },
584 { WM_GETTEXT, sent|defwinproc|optional },
585 { WM_WINDOWPOSCHANGED, sent },
586 { WM_MOVE, sent|defwinproc },
587 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
588 { WM_NCCALCSIZE, sent|optional },
589 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
590 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
591 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
592 { WM_NCACTIVATE, sent|wparam, 0 },
593 { WM_GETTEXT, sent|defwinproc|optional },
594 { WM_ACTIVATE, sent },
595 { WM_ACTIVATEAPP, sent|wparam, 0 },
596
597 /* Vista sometimes restores the window right away... */
598 { WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
599 { HCBT_SYSCOMMAND, hook|optional|wparam, SC_RESTORE },
600 { HCBT_MINMAX, hook|optional|lparam, 0, SW_RESTORE },
601 { WM_QUERYOPEN, sent|optional },
602 { WM_WINDOWPOSCHANGING, sent|optional|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
603 { WM_GETMINMAXINFO, sent|optional|defwinproc },
604 { WM_NCCALCSIZE, sent|optional|wparam, TRUE },
605 { HCBT_ACTIVATE, hook|optional },
606 { WM_ACTIVATEAPP, sent|optional|wparam, 1 },
607 { WM_NCACTIVATE, sent|optional },
608 { WM_GETTEXT, sent|optional },
609 { WM_ACTIVATE, sent|optional|wparam, 1 },
610 { HCBT_SETFOCUS, hook|optional },
611 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
612 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
613 { WM_SETFOCUS, sent|optional },
614 { WM_NCPAINT, sent|optional },
615 { WM_GETTEXT, sent|defwinproc|optional },
616 { WM_ERASEBKGND, sent|optional },
617 { WM_WINDOWPOSCHANGED, sent|optional|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
618 { WM_MOVE, sent|defwinproc|optional },
619 { WM_SIZE, sent|defwinproc|optional|wparam, SIZE_RESTORED },
620 { WM_ACTIVATE, sent|optional|wparam, 1 },
621 { WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE },
622 { HCBT_SYSCOMMAND, hook|optional|wparam, SC_RESTORE },
623
624 { WM_PAINT, sent|optional },
625 { WM_NCPAINT, sent|beginpaint|optional },
626 { WM_ERASEBKGND, sent|beginpaint|optional },
627 { 0 }
628 };
629 /* ShowWindow(SW_HIDE) for a visible overlapped window */
630 static const struct message WmHideOverlappedSeq[] = {
631 { WM_SHOWWINDOW, sent|wparam, 0 },
632 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE },
633 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
634 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
635 { WM_SIZE, sent|optional }, /* XP doesn't send it */
636 { WM_MOVE, sent|optional }, /* XP doesn't send it */
637 { WM_NCACTIVATE, sent|wparam|optional, 0 },
638 { WM_ACTIVATE, sent|wparam|optional, 0 },
639 { WM_ACTIVATEAPP, sent|wparam|optional, 0 },
640 { HCBT_SETFOCUS, hook|optional },
641 { WM_KILLFOCUS, sent|wparam, 0 },
642 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
643 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
644 { 0 }
645 };
646 /* DestroyWindow for a visible overlapped window */
647 static const struct message WmDestroyOverlappedSeq[] = {
648 { HCBT_DESTROYWND, hook },
649 { 0x0090, sent|optional },
650 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
651 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
652 { 0x0090, sent|optional },
653 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
654 { WM_NCACTIVATE, sent|optional|wparam, 0 },
655 { WM_ACTIVATE, sent|optional },
656 { WM_ACTIVATEAPP, sent|optional|wparam, 0 },
657 { WM_KILLFOCUS, sent|optional|wparam, 0 },
658 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
659 { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
660 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
661 { WM_DESTROY, sent },
662 { WM_NCDESTROY, sent },
663 { 0 }
664 };
665 /* CreateWindow(WS_MAXIMIZE|WS_VISIBLE) for popup window */
666 static const struct message WmCreateMaxPopupSeq[] = {
667 { HCBT_CREATEWND, hook },
668 { WM_NCCREATE, sent },
669 { WM_NCCALCSIZE, sent|wparam, 0 },
670 { WM_CREATE, sent },
671 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
672 { WM_SIZE, sent|wparam, SIZE_RESTORED },
673 { WM_MOVE, sent },
674 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
675 { WM_GETMINMAXINFO, sent },
676 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
677 { WM_NCCALCSIZE, sent|wparam, TRUE },
678 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
679 { WM_MOVE, sent|defwinproc },
680 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
681 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
682 { WM_SHOWWINDOW, sent|wparam, 1 },
683 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
684 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
685 { HCBT_ACTIVATE, hook },
686 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
687 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
688 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
689 { WM_NCPAINT, sent|wparam|optional, 1 },
690 { WM_ERASEBKGND, sent|optional },
691 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_NOMOVE|SWP_NOSIZE },
692 { WM_ACTIVATEAPP, sent|wparam, 1 },
693 { WM_NCACTIVATE, sent },
694 { WM_ACTIVATE, sent|wparam, 1 },
695 { HCBT_SETFOCUS, hook },
696 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
697 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
698 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
699 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
700 { WM_GETTEXT, sent|optional },
701 { WM_SYNCPAINT, sent|wparam|optional, 4 },
702 { WM_NCPAINT, sent|wparam|optional, 1 },
703 { WM_ERASEBKGND, sent|optional },
704 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
705 { WM_ERASEBKGND, sent|defwinproc|optional },
706 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
707 { 0 }
708 };
709 /* CreateWindow(WS_MAXIMIZE) for popup window, not initially visible */
710 static const struct message WmCreateInvisibleMaxPopupSeq[] = {
711 { HCBT_CREATEWND, hook },
712 { WM_NCCREATE, sent },
713 { WM_NCCALCSIZE, sent|wparam, 0 },
714 { WM_CREATE, sent },
715 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
716 { WM_SIZE, sent|wparam, SIZE_RESTORED },
717 { WM_MOVE, sent },
718 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
719 { WM_GETMINMAXINFO, sent },
720 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_STATECHANGED },
721 { WM_NCCALCSIZE, sent|wparam, TRUE },
722 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_STATECHANGED },
723 { WM_MOVE, sent|defwinproc },
724 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
725 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
726 { 0 }
727 };
728 /* ShowWindow(SW_SHOWMAXIMIZED) for a resized not visible popup window */
729 static const struct message WmShowMaxPopupResizedSeq[] = {
730 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
731 { WM_GETMINMAXINFO, sent },
732 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
733 { WM_NCCALCSIZE, sent|wparam, TRUE },
734 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
735 { HCBT_ACTIVATE, hook },
736 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
737 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
738 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
739 { WM_NCPAINT, sent|wparam|optional, 1 },
740 { WM_ERASEBKGND, sent|optional },
741 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
742 { WM_ACTIVATEAPP, sent|wparam, 1 },
743 { WM_NCACTIVATE, sent },
744 { WM_ACTIVATE, sent|wparam, 1 },
745 { HCBT_SETFOCUS, hook },
746 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
747 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
748 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
749 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
750 { WM_GETTEXT, sent|optional },
751 { WM_NCPAINT, sent|wparam|optional, 1 },
752 { WM_ERASEBKGND, sent|optional },
753 { WM_WINDOWPOSCHANGED, sent },
754 /* WinNT4.0 sends WM_MOVE */
755 { WM_MOVE, sent|defwinproc|optional },
756 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
757 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
758 { 0 }
759 };
760 /* ShowWindow(SW_SHOWMAXIMIZED) for a not visible popup window */
761 static const struct message WmShowMaxPopupSeq[] = {
762 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
763 { WM_GETMINMAXINFO, sent },
764 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED },
765 { WM_NCCALCSIZE, sent|wparam, TRUE },
766 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
767 { HCBT_ACTIVATE, hook },
768 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
769 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
770 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
771 { WM_ACTIVATEAPP, sent|wparam, 1 },
772 { WM_NCACTIVATE, sent },
773 { WM_ACTIVATE, sent|wparam, 1 },
774 { HCBT_SETFOCUS, hook },
775 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
776 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
777 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
778 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
779 { WM_GETTEXT, sent|optional },
780 { WM_SYNCPAINT, sent|wparam|optional, 4 },
781 { WM_NCPAINT, sent|wparam|optional, 1 },
782 { WM_ERASEBKGND, sent|optional },
783 { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
784 { WM_ERASEBKGND, sent|defwinproc|optional },
785 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE },
786 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
787 { 0 }
788 };
789 /* CreateWindow(WS_VISIBLE) for popup window */
790 static const struct message WmCreatePopupSeq[] = {
791 { HCBT_CREATEWND, hook },
792 { WM_NCCREATE, sent },
793 { WM_NCCALCSIZE, sent|wparam, 0 },
794 { WM_CREATE, sent },
795 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
796 { WM_SIZE, sent|wparam, SIZE_RESTORED },
797 { WM_MOVE, sent },
798 { WM_SHOWWINDOW, sent|wparam, 1 },
799 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
800 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
801 { HCBT_ACTIVATE, hook },
802 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
803 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
804 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
805 { WM_NCPAINT, sent|wparam|optional, 1 },
806 { WM_ERASEBKGND, sent|optional },
807 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
808 { WM_ACTIVATEAPP, sent|wparam, 1 },
809 { WM_NCACTIVATE, sent },
810 { WM_ACTIVATE, sent|wparam, 1 },
811 { HCBT_SETFOCUS, hook },
812 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
813 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
814 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
815 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
816 { WM_GETTEXT, sent|optional },
817 { WM_SYNCPAINT, sent|wparam|optional, 4 },
818 { WM_NCPAINT, sent|wparam|optional, 1 },
819 { WM_ERASEBKGND, sent|optional },
820 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOCLIENTMOVE|SWP_NOCLIENTSIZE|SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE },
821 { 0 }
822 };
823 /* ShowWindow(SW_SHOWMAXIMIZED) for a visible popup window */
824 static const struct message WmShowVisMaxPopupSeq[] = {
825 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
826 { WM_GETMINMAXINFO, sent },
827 { WM_GETTEXT, sent|optional },
828 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
829 { WM_GETTEXT, sent|optional },
830 { WM_NCCALCSIZE, sent|wparam, TRUE },
831 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
832 { WM_NCPAINT, sent|wparam|optional, 1 },
833 { WM_ERASEBKGND, sent|optional },
834 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
835 { WM_MOVE, sent|defwinproc },
836 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
837 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
838 { 0 }
839 };
840 /* CreateWindow (for a child popup window, not initially visible) */
841 static const struct message WmCreateChildPopupSeq[] = {
842 { HCBT_CREATEWND, hook },
843 { WM_NCCREATE, sent },
844 { WM_NCCALCSIZE, sent|wparam, 0 },
845 { WM_CREATE, sent },
846 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
847 { WM_SIZE, sent|wparam, SIZE_RESTORED },
848 { WM_MOVE, sent },
849 { 0 }
850 };
851 /* CreateWindow (for a popup window, not initially visible,
852 * which sets WS_VISIBLE in WM_CREATE handler)
853 */
854 static const struct message WmCreateInvisiblePopupSeq[] = {
855 { HCBT_CREATEWND, hook },
856 { WM_NCCREATE, sent },
857 { WM_NCCALCSIZE, sent|wparam, 0 },
858 { WM_CREATE, sent },
859 { WM_STYLECHANGING, sent },
860 { WM_STYLECHANGED, sent },
861 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
862 { WM_SIZE, sent|wparam, SIZE_RESTORED },
863 { WM_MOVE, sent },
864 { 0 }
865 };
866 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER)
867 * for a popup window with WS_VISIBLE style set
868 */
869 static const struct message WmShowVisiblePopupSeq_2[] = {
870 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
871 { 0 }
872 };
873 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
874 * for a popup window with WS_VISIBLE style set
875 */
876 static const struct message WmShowVisiblePopupSeq_3[] = {
877 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
878 { HCBT_ACTIVATE, hook },
879 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
880 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
881 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
882 { WM_NCACTIVATE, sent },
883 { WM_ACTIVATE, sent|wparam, 1 },
884 { HCBT_SETFOCUS, hook },
885 { WM_KILLFOCUS, sent|parent },
886 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
887 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
888 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
889 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
890 { WM_SETFOCUS, sent|defwinproc },
891 { WM_GETTEXT, sent|optional },
892 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_SHOWWINDOW },
893 { 0 }
894 };
895 /* CreateWindow (for child window, not initially visible) */
896 static const struct message WmCreateChildSeq[] = {
897 { HCBT_CREATEWND, hook },
898 { WM_NCCREATE, sent },
899 /* child is inserted into parent's child list after WM_NCCREATE returns */
900 { WM_NCCALCSIZE, sent|wparam, 0 },
901 { WM_CREATE, sent },
902 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
903 { WM_SIZE, sent|wparam, SIZE_RESTORED },
904 { WM_MOVE, sent },
905 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
906 { 0 }
907 };
908 /* CreateWindow (for maximized child window, not initially visible) */
909 static const struct message WmCreateMaximizedChildSeq[] = {
910 { HCBT_CREATEWND, hook },
911 { WM_NCCREATE, sent },
912 { WM_NCCALCSIZE, sent|wparam, 0 },
913 { WM_CREATE, sent },
914 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
915 { WM_SIZE, sent|wparam, SIZE_RESTORED },
916 { WM_MOVE, sent },
917 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
918 { WM_GETMINMAXINFO, sent },
919 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
920 { WM_NCCALCSIZE, sent|wparam, 1 },
921 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
922 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
923 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
924 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
925 { 0 }
926 };
927 /* CreateWindow (for a child window, initially visible) */
928 static const struct message WmCreateVisibleChildSeq[] = {
929 { HCBT_CREATEWND, hook },
930 { WM_NCCREATE, sent },
931 /* child is inserted into parent's child list after WM_NCCREATE returns */
932 { WM_NCCALCSIZE, sent|wparam, 0 },
933 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
934 { WM_CREATE, sent },
935 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
936 { WM_SIZE, sent|wparam, SIZE_RESTORED },
937 { WM_MOVE, sent },
938 { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE },
939 { WM_SHOWWINDOW, sent|wparam, 1 },
940 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
941 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
942 { WM_ERASEBKGND, sent|parent|optional },
943 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
944 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* WinXP */
945 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
946 { 0 }
947 };
948 /* ShowWindow(SW_SHOW) for a not visible child window */
949 static const struct message WmShowChildSeq[] = {
950 { WM_SHOWWINDOW, sent|wparam, 1 },
951 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
952 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
953 { WM_ERASEBKGND, sent|parent|optional },
954 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
955 { 0 }
956 };
957 /* ShowWindow(SW_HIDE) for a visible child window */
958 static const struct message WmHideChildSeq[] = {
959 { WM_SHOWWINDOW, sent|wparam, 0 },
960 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
961 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
962 { WM_ERASEBKGND, sent|parent|optional },
963 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
964 { 0 }
965 };
966 /* ShowWindow(SW_HIDE) for a visible child window checking all parent events*/
967 static const struct message WmHideChildSeq2[] = {
968 { WM_SHOWWINDOW, sent|wparam, 0 },
969 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
970 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
971 { WM_ERASEBKGND, sent|parent|optional },
972 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
973 { 0 }
974 };
975 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
976 * for a not visible child window
977 */
978 static const struct message WmShowChildSeq_2[] = {
979 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
980 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
981 { WM_CHILDACTIVATE, sent },
982 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
983 { 0 }
984 };
985 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE)
986 * for a not visible child window
987 */
988 static const struct message WmShowChildSeq_3[] = {
989 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
990 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
991 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
992 { 0 }
993 };
994 /* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE)
995 * for a visible child window with a caption
996 */
997 static const struct message WmShowChildSeq_4[] = {
998 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
999 { WM_CHILDACTIVATE, sent },
1000 { 0 }
1001 };
1002 /* ShowWindow(SW_MINIMIZE) for child with invisible parent */
1003 static const struct message WmShowChildInvisibleParentSeq_1[] = {
1004 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1005 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1006 { WM_NCCALCSIZE, sent|wparam, 1 },
1007 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1008 { WM_CHILDACTIVATE, sent|optional },
1009 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE },
1010 { WM_MOVE, sent|defwinproc },
1011 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1012 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1013 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1014 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1015 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1016 { WM_GETTEXT, sent|optional },
1017 { 0 }
1018 };
1019 /* repeated ShowWindow(SW_MINIMIZE) for child with invisible parent */
1020 static const struct message WmShowChildInvisibleParentSeq_1r[] = {
1021 { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE },
1022 { 0 }
1023 };
1024 /* ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1025 static const struct message WmShowChildInvisibleParentSeq_2[] = {
1026 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1027 { WM_GETMINMAXINFO, sent },
1028 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_STATECHANGED },
1029 { WM_NCCALCSIZE, sent|wparam, 1 },
1030 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1031 { WM_CHILDACTIVATE, sent },
1032 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
1033 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
1034 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1035 { 0 }
1036 };
1037 /* repeated ShowWindow(SW_MAXIMIZE) for child with invisible parent */
1038 static const struct message WmShowChildInvisibleParentSeq_2r[] = {
1039 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
1040 { 0 }
1041 };
1042 /* ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1043 static const struct message WmShowChildInvisibleParentSeq_3[] = {
1044 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1045 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
1046 { WM_NCCALCSIZE, sent|wparam, 1 },
1047 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1048 { WM_CHILDACTIVATE, sent },
1049 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1050 { WM_MOVE, sent|defwinproc },
1051 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1052 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1053 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1054 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1055 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1056 { WM_GETTEXT, sent|optional },
1057 { 0 }
1058 };
1059 /* repeated ShowWindow(SW_SHOWMINIMIZED) for child with invisible parent */
1060 static const struct message WmShowChildInvisibleParentSeq_3r[] = {
1061 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINIMIZED },
1062 { 0 }
1063 };
1064 /* ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1065 static const struct message WmShowChildInvisibleParentSeq_4[] = {
1066 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1067 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_STATECHANGED },
1068 { WM_NCCALCSIZE, sent|wparam, 1 },
1069 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1070 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCOPYBITS|SWP_STATECHANGED },
1071 { WM_MOVE, sent|defwinproc },
1072 { WM_SIZE, sent|defwinproc|wparam|lparam, SIZE_MINIMIZED, 0 },
1073 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1074 { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 },
1075 /* FIXME: Wine creates an icon/title window while Windows doesn't */
1076 { WM_PARENTNOTIFY, sent|parent|wparam|optional, WM_CREATE },
1077 { WM_GETTEXT, sent|optional },
1078 { 0 }
1079 };
1080 /* repeated ShowWindow(SW_SHOWMINNOACTIVE) for child with invisible parent */
1081 static const struct message WmShowChildInvisibleParentSeq_4r[] = {
1082 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWMINNOACTIVE },
1083 { 0 }
1084 };
1085 /* ShowWindow(SW_SHOW) for child with invisible parent */
1086 static const struct message WmShowChildInvisibleParentSeq_5[] = {
1087 { WM_SHOWWINDOW, sent|wparam, 1 },
1088 { 0 }
1089 };
1090 /* ShowWindow(SW_HIDE) for child with invisible parent */
1091 static const struct message WmHideChildInvisibleParentSeq[] = {
1092 { WM_SHOWWINDOW, sent|wparam, 0 },
1093 { 0 }
1094 };
1095 /* SetWindowPos(SWP_SHOWWINDOW) for child with invisible parent */
1096 static const struct message WmShowChildInvisibleParentSeq_6[] = {
1097 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1098 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1099 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1100 { 0 }
1101 };
1102 /* SetWindowPos(SWP_HIDEWINDOW) for child with invisible parent */
1103 static const struct message WmHideChildInvisibleParentSeq_2[] = {
1104 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1105 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1106 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1107 { 0 }
1108 };
1109 /* DestroyWindow for a visible child window */
1110 static const struct message WmDestroyChildSeq[] = {
1111 { HCBT_DESTROYWND, hook },
1112 { 0x0090, sent|optional },
1113 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1114 { WM_SHOWWINDOW, sent|wparam, 0 },
1115 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1116 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1117 { WM_ERASEBKGND, sent|parent|optional },
1118 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1119 { HCBT_SETFOCUS, hook }, /* set focus to a parent */
1120 { WM_KILLFOCUS, sent },
1121 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1122 { WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 },
1123 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1124 { WM_SETFOCUS, sent|parent },
1125 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1126 { WM_DESTROY, sent },
1127 { WM_DESTROY, sent|optional }, /* some other (IME?) window */
1128 { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */
1129 { WM_NCDESTROY, sent },
1130 { 0 }
1131 };
1132 /* visible child window destroyed by thread exit */
1133 static const struct message WmExitThreadSeq[] = {
1134 { WM_NCDESTROY, sent }, /* actually in grandchild */
1135 { WM_PAINT, sent|parent },
1136 { WM_ERASEBKGND, sent|parent|beginpaint },
1137 { 0 }
1138 };
1139 /* DestroyWindow for a visible child window with invisible parent */
1140 static const struct message WmDestroyInvisibleChildSeq[] = {
1141 { HCBT_DESTROYWND, hook },
1142 { 0x0090, sent|optional },
1143 { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY },
1144 { WM_SHOWWINDOW, sent|wparam, 0 },
1145 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1146 { WM_DESTROY, sent },
1147 { WM_NCDESTROY, sent },
1148 { 0 }
1149 };
1150 /* Moving the mouse in nonclient area */
1151 static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */
1152 { WM_NCHITTEST, sent },
1153 { WM_SETCURSOR, sent },
1154 { WM_NCMOUSEMOVE, posted },
1155 { 0 }
1156 };
1157 /* Moving the mouse in client area */
1158 static const struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */
1159 { WM_NCHITTEST, sent },
1160 { WM_SETCURSOR, sent },
1161 { WM_MOUSEMOVE, posted },
1162 { 0 }
1163 };
1164 /* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1165 static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */
1166 { WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION },
1167 { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 },
1168 { WM_GETMINMAXINFO, sent|defwinproc },
1169 { WM_ENTERSIZEMOVE, sent|defwinproc },
1170 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1171 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1172 { WM_MOVE, sent|defwinproc },
1173 { WM_EXITSIZEMOVE, sent|defwinproc },
1174 { 0 }
1175 };
1176 /* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */
1177 static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */
1178 { WM_NCLBUTTONDOWN, sent|wparam, 0xd },
1179 { WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 },
1180 { WM_GETMINMAXINFO, sent|defwinproc },
1181 { WM_ENTERSIZEMOVE, sent|defwinproc },
1182 { WM_SIZING, sent|defwinproc|wparam, 4}, /* one for each mouse movement */
1183 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, 0 },
1184 { WM_GETMINMAXINFO, sent|defwinproc },
1185 { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 },
1186 { WM_NCPAINT, sent|defwinproc|wparam, 1 },
1187 { WM_GETTEXT, sent|defwinproc },
1188 { WM_ERASEBKGND, sent|defwinproc },
1189 { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, 0 },
1190 { WM_MOVE, sent|defwinproc },
1191 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1192 { WM_EXITSIZEMOVE, sent|defwinproc },
1193 { 0 }
1194 };
1195 /* Resizing child window with MoveWindow (32) */
1196 static const struct message WmResizingChildWithMoveWindowSeq[] = {
1197 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOACTIVATE },
1198 { WM_NCCALCSIZE, sent|wparam, 1 },
1199 { WM_ERASEBKGND, sent|parent|optional },
1200 { WM_ERASEBKGND, sent|optional },
1201 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE },
1202 { WM_MOVE, sent|defwinproc },
1203 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1204 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1205 { 0 }
1206 };
1207 /* Clicking on inactive button */
1208 static const struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */
1209 { WM_NCHITTEST, sent },
1210 { WM_PARENTNOTIFY, sent|parent|wparam, WM_LBUTTONDOWN },
1211 { WM_MOUSEACTIVATE, sent },
1212 { WM_MOUSEACTIVATE, sent|parent|defwinproc },
1213 { WM_SETCURSOR, sent },
1214 { WM_SETCURSOR, sent|parent|defwinproc },
1215 { WM_LBUTTONDOWN, posted },
1216 { WM_KILLFOCUS, posted|parent },
1217 { WM_SETFOCUS, posted },
1218 { WM_CTLCOLORBTN, posted|parent },
1219 { BM_SETSTATE, posted },
1220 { WM_CTLCOLORBTN, posted|parent },
1221 { WM_LBUTTONUP, posted },
1222 { BM_SETSTATE, posted },
1223 { WM_CTLCOLORBTN, posted|parent },
1224 { WM_COMMAND, posted|parent },
1225 { 0 }
1226 };
1227 /* Reparenting a button (16/32) */
1228 /* The last child (button) reparented gets topmost for its new parent. */
1229 static const struct message WmReparentButtonSeq[] = { /* FIXME: add */
1230 { WM_SHOWWINDOW, sent|wparam, 0 },
1231 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1232 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1233 { WM_ERASEBKGND, sent|parent },
1234 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1235 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE },
1236 { WM_CHILDACTIVATE, sent },
1237 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW },
1238 { WM_MOVE, sent|defwinproc },
1239 { WM_SHOWWINDOW, sent|wparam, 1 },
1240 { 0 }
1241 };
1242 /* Creation of a custom dialog (32) */
1243 static const struct message WmCreateCustomDialogSeq[] = {
1244 { HCBT_CREATEWND, hook },
1245 { WM_GETMINMAXINFO, sent },
1246 { WM_NCCREATE, sent },
1247 { WM_NCCALCSIZE, sent|wparam, 0 },
1248 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1249 { WM_CREATE, sent },
1250 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1251 { WM_NOTIFYFORMAT, sent|optional },
1252 { WM_QUERYUISTATE, sent|optional },
1253 { WM_WINDOWPOSCHANGING, sent|optional },
1254 { WM_GETMINMAXINFO, sent|optional },
1255 { WM_NCCALCSIZE, sent|optional },
1256 { WM_WINDOWPOSCHANGED, sent|optional },
1257 { WM_SHOWWINDOW, sent|wparam, 1 },
1258 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1259 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1260 { HCBT_ACTIVATE, hook },
1261 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1262
1263
1264 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1265
1266 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1267
1268 { WM_NCACTIVATE, sent },
1269 { WM_GETTEXT, sent|optional|defwinproc },
1270 { WM_GETTEXT, sent|optional|defwinproc },
1271 { WM_GETTEXT, sent|optional|defwinproc },
1272 { EVENT_OBJECT_DEFACTIONCHANGE, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
1273 { WM_ACTIVATE, sent|wparam, 1 },
1274 { WM_GETTEXT, sent|optional },
1275 { WM_KILLFOCUS, sent|parent },
1276 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1277 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1278 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1279 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1280 { WM_SETFOCUS, sent },
1281 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1282 { WM_NCPAINT, sent|wparam, 1 },
1283 { WM_GETTEXT, sent|optional|defwinproc },
1284 { WM_GETTEXT, sent|optional|defwinproc },
1285 { WM_ERASEBKGND, sent },
1286 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1287 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1288 { WM_GETTEXT, sent|optional },
1289 { WM_GETTEXT, sent|optional },
1290 { WM_NCCALCSIZE, sent|optional },
1291 { WM_NCPAINT, sent|optional },
1292 { WM_GETTEXT, sent|optional|defwinproc },
1293 { WM_GETTEXT, sent|optional|defwinproc },
1294 { WM_ERASEBKGND, sent|optional },
1295 { WM_CTLCOLORDLG, sent|optional|defwinproc },
1296 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1297 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1298 { WM_MOVE, sent },
1299 { 0 }
1300 };
1301 /* Calling EndDialog for a custom dialog (32) */
1302 static const struct message WmEndCustomDialogSeq[] = {
1303 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1304 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1305 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1306 { WM_GETTEXT, sent|optional },
1307 { HCBT_ACTIVATE, hook },
1308 { WM_NCACTIVATE, sent|wparam, 0 },
1309 { WM_GETTEXT, sent|optional|defwinproc },
1310 { WM_GETTEXT, sent|optional|defwinproc },
1311 { WM_ACTIVATE, sent|wparam, 0 },
1312 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1313 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1314 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1315 { WM_GETTEXT, sent|optional|defwinproc },
1316 { WM_GETTEXT, sent|optional|defwinproc },
1317 { HCBT_SETFOCUS, hook },
1318 { WM_KILLFOCUS, sent },
1319 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
1320 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1321 { WM_IME_NOTIFY, sent|wparam|optional, 1 },
1322 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1323 { WM_SETFOCUS, sent|parent|defwinproc },
1324 { 0 }
1325 };
1326 /* ShowWindow(SW_SHOW) for a custom dialog (initially invisible) */
1327 static const struct message WmShowCustomDialogSeq[] = {
1328 { WM_SHOWWINDOW, sent|wparam, 1 },
1329 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
1330 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1331 { HCBT_ACTIVATE, hook },
1332 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1333
1334 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1335
1336 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
1337 { WM_ACTIVATEAPP, sent|wparam|optional, 1 },
1338 { WM_NCACTIVATE, sent },
1339 { WM_ACTIVATE, sent|wparam, 1 },
1340 { WM_GETTEXT, sent|optional },
1341
1342 { WM_KILLFOCUS, sent|parent },
1343 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1344 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
1345 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
1346 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1347 { WM_SETFOCUS, sent },
1348 { WM_GETDLGCODE, sent|defwinproc|wparam, 0 },
1349 { WM_NCPAINT, sent|wparam, 1 },
1350 { WM_ERASEBKGND, sent },
1351 { WM_CTLCOLORDLG, sent|defwinproc },
1352 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1353 { 0 }
1354 };
1355 /* Creation and destruction of a modal dialog (32) */
1356 static const struct message WmModalDialogSeq[] = {
1357 { WM_CANCELMODE, sent|parent },
1358 { HCBT_SETFOCUS, hook },
1359 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1360 { WM_KILLFOCUS, sent|parent },
1361 { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 },
1362 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1363 { WM_ENABLE, sent|parent|wparam, 0 },
1364 { HCBT_CREATEWND, hook },
1365 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1366 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
1367 { WM_SETFONT, sent },
1368 { WM_INITDIALOG, sent },
1369 { WM_CHANGEUISTATE, sent|optional },
1370 { WM_UPDATEUISTATE, sent|optional },
1371 { WM_SHOWWINDOW, sent },
1372 { HCBT_ACTIVATE, hook },
1373 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1374 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
1375 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
1376 { WM_NCACTIVATE, sent },
1377 { WM_GETTEXT, sent|optional },
1378 { WM_ACTIVATE, sent|wparam, 1 },
1379 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1380 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1381 { WM_NCPAINT, sent|optional },
1382 { WM_GETTEXT, sent|optional },
1383 { WM_ERASEBKGND, sent|optional },
1384 { WM_CTLCOLORDLG, sent|optional },
1385 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1386 { WM_GETTEXT, sent|optional },
1387 { WM_NCCALCSIZE, sent|optional },
1388 { WM_NCPAINT, sent|optional },
1389 { WM_GETTEXT, sent|optional },
1390 { WM_ERASEBKGND, sent|optional },
1391 { WM_CTLCOLORDLG, sent|optional },
1392 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1393 { WM_PAINT, sent|optional },
1394 { WM_CTLCOLORBTN, sent|optional },
1395 { WM_GETTITLEBARINFOEX, sent|optional },
1396 { WM_ENTERIDLE, sent|parent|optional },
1397 { WM_ENTERIDLE, sent|parent|optional },
1398 { WM_ENTERIDLE, sent|parent|optional },
1399 { WM_ENTERIDLE, sent|parent|optional },
1400 { WM_ENTERIDLE, sent|parent|optional },
1401 { WM_ENTERIDLE, sent|parent|optional },
1402 { WM_ENTERIDLE, sent|parent|optional },
1403 { WM_ENTERIDLE, sent|parent|optional },
1404 { WM_ENTERIDLE, sent|parent|optional },
1405 { WM_ENTERIDLE, sent|parent|optional },
1406 { WM_ENTERIDLE, sent|parent|optional },
1407 { WM_ENTERIDLE, sent|parent|optional },
1408 { WM_ENTERIDLE, sent|parent|optional },
1409 { WM_ENTERIDLE, sent|parent|optional },
1410 { WM_ENTERIDLE, sent|parent|optional },
1411 { WM_ENTERIDLE, sent|parent|optional },
1412 { WM_ENTERIDLE, sent|parent|optional },
1413 { WM_ENTERIDLE, sent|parent|optional },
1414 { WM_ENTERIDLE, sent|parent|optional },
1415 { WM_ENTERIDLE, sent|parent|optional },
1416 { WM_TIMER, sent },
1417 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1418 { WM_ENABLE, sent|parent|wparam, 1 },
1419 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1420 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
1421 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1422 { WM_GETTEXT, sent|optional },
1423 { HCBT_ACTIVATE, hook },
1424 { WM_NCACTIVATE, sent|wparam, 0 },
1425 { WM_GETTEXT, sent|optional },
1426 { WM_ACTIVATE, sent|wparam, 0 },
1427 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
1428 { WM_WINDOWPOSCHANGING, sent|optional },
1429 { WM_WINDOWPOSCHANGED, sent|optional },
1430 { HCBT_SETFOCUS, hook },
1431 { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 },
1432 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
1433 { WM_SETFOCUS, sent|parent|defwinproc },
1434 { EVENT_SYSTEM_DIALOGEND, winevent_hook|wparam|lparam, 0, 0 },
1435 { HCBT_DESTROYWND, hook },
1436 { 0x0090, sent|optional },
1437 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
1438 { WM_DESTROY, sent },
1439 { WM_NCDESTROY, sent },
1440 { 0 }
1441 };
1442 /* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */
1443 static const struct message WmCreateModalDialogResizeSeq[] = { /* FIXME: add */
1444 /* (inside dialog proc, handling WM_INITDIALOG) */
1445 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1446 { WM_NCCALCSIZE, sent },
1447 { WM_NCACTIVATE, sent|parent|wparam, 0 },
1448 { WM_GETTEXT, sent|defwinproc },
1449 { WM_ACTIVATE, sent|parent|wparam, 0 },
1450 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1451 { WM_WINDOWPOSCHANGING, sent|parent },
1452 { WM_NCACTIVATE, sent|wparam, 1 },
1453 { WM_ACTIVATE, sent|wparam, 1 },
1454 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1455 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1456 /* (setting focus) */
1457 { WM_SHOWWINDOW, sent|wparam, 1 },
1458 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
1459 { WM_NCPAINT, sent },
1460 { WM_GETTEXT, sent|defwinproc },
1461 { WM_ERASEBKGND, sent },
1462 { WM_CTLCOLORDLG, sent|defwinproc },
1463 { WM_WINDOWPOSCHANGED, sent|wparam, 0 },
1464 { WM_PAINT, sent },
1465 /* (bunch of WM_CTLCOLOR* for each control) */
1466 { WM_PAINT, sent|parent },
1467 { WM_ENTERIDLE, sent|parent|wparam, 0 },
1468 { WM_SETCURSOR, sent|parent },
1469 { 0 }
1470 };
1471 /* SetMenu for NonVisible windows with size change*/
1472 static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = {
1473 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1474 { WM_NCCALCSIZE, sent|wparam, 1 },
1475 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1476 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW },
1477 { WM_MOVE, sent|defwinproc },
1478 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1479 { WM_NCCALCSIZE,sent|wparam|optional, 1 }, /* XP */
1480 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1481 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1482 { WM_GETTEXT, sent|optional },
1483 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1484 { 0 }
1485 };
1486 /* SetMenu for NonVisible windows with no size change */
1487 static const struct message WmSetMenuNonVisibleNoSizeChangeSeq[] = {
1488 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1489 { WM_NCCALCSIZE, sent|wparam, 1 },
1490 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1491 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1492 { 0 }
1493 };
1494 /* SetMenu for Visible windows with size change */
1495 static const struct message WmSetMenuVisibleSizeChangeSeq[] = {
1496 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1497 { WM_NCCALCSIZE, sent|wparam, 1 },
1498 { 0x0093, sent|defwinproc|optional },
1499 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1500 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1501 { 0x0093, sent|defwinproc|optional },
1502 { 0x0093, sent|defwinproc|optional },
1503 { 0x0091, sent|defwinproc|optional },
1504 { 0x0092, sent|defwinproc|optional },
1505 { WM_GETTEXT, sent|defwinproc|optional },
1506 { WM_ERASEBKGND, sent|optional },
1507 { WM_ACTIVATE, sent|optional },
1508 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1509 { WM_MOVE, sent|defwinproc },
1510 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
1511 { 0x0093, sent|optional },
1512 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1513 { 0x0093, sent|defwinproc|optional },
1514 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1515 { 0x0093, sent|defwinproc|optional },
1516 { 0x0093, sent|defwinproc|optional },
1517 { 0x0091, sent|defwinproc|optional },
1518 { 0x0092, sent|defwinproc|optional },
1519 { WM_ERASEBKGND, sent|optional },
1520 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1521 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP sends a duplicate */
1522 { 0 }
1523 };
1524 /* SetMenu for Visible windows with no size change */
1525 static const struct message WmSetMenuVisibleNoSizeChangeSeq[] = {
1526 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1527 { WM_NCCALCSIZE, sent|wparam, 1 },
1528 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1529 { WM_GETTEXT, sent|defwinproc|optional },
1530 { WM_ERASEBKGND, sent|optional },
1531 { WM_ACTIVATE, sent|optional },
1532 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1533 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1534 { 0 }
1535 };
1536 /* DrawMenuBar for a visible window */
1537 static const struct message WmDrawMenuBarSeq[] =
1538 {
1539 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1540 { WM_NCCALCSIZE, sent|wparam, 1 },
1541 { 0x0093, sent|defwinproc|optional },
1542 { WM_NCPAINT, sent|optional }, /* wparam != 1 */
1543 { 0x0093, sent|defwinproc|optional },
1544 { 0x0093, sent|defwinproc|optional },
1545 { 0x0091, sent|defwinproc|optional },
1546 { 0x0092, sent|defwinproc|optional },
1547 { WM_GETTEXT, sent|defwinproc|optional },
1548 { WM_ERASEBKGND, sent|optional },
1549 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1550 { 0x0093, sent|optional },
1551 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1552 { 0 }
1553 };
1554
1555 static const struct message WmSetRedrawFalseSeq[] =
1556 {
1557 { WM_SETREDRAW, sent|wparam, 0 },
1558 { 0 }
1559 };
1560
1561 static const struct message WmSetRedrawTrueSeq[] =
1562 {
1563 { WM_SETREDRAW, sent|wparam, 1 },
1564 { 0 }
1565 };
1566
1567 static const struct message WmEnableWindowSeq_1[] =
1568 {
1569 { WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
1570 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1571 { HCBT_SETFOCUS, hook|optional },
1572 { WM_KILLFOCUS, sent|optional },
1573 { WM_ENABLE, sent|wparam|lparam, FALSE, 0 },
1574 { 0 }
1575 };
1576
1577 static const struct message WmEnableWindowSeq_2[] =
1578 {
1579 { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
1580 { WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
1581 { 0 }
1582 };
1583
1584 static const struct message WmGetScrollRangeSeq[] =
1585 {
1586 { SBM_GETRANGE, sent },
1587 { 0 }
1588 };
1589 static const struct message WmGetScrollInfoSeq[] =
1590 {
1591 { SBM_GETSCROLLINFO, sent },
1592 { 0 }
1593 };
1594 static const struct message WmSetScrollRangeSeq[] =
1595 {
1596 /* MSDN claims that Windows sends SBM_SETRANGE message, but win2k SP4
1597 sends SBM_SETSCROLLINFO.
1598 */
1599 { SBM_SETSCROLLINFO, sent },
1600 { 0 }
1601 };
1602 /* SetScrollRange for a window without a non-client area */
1603 static const struct message WmSetScrollRangeHSeq_empty[] =
1604 {
1605 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_HSCROLL, 0 },
1606 { 0 }
1607 };
1608 static const struct message WmSetScrollRangeVSeq_empty[] =
1609 {
1610 { EVENT_OBJECT_VALUECHANGE, winevent_hook|wparam|lparam, OBJID_VSCROLL, 0 },
1611 { 0 }
1612 };
1613 static const struct message WmSetScrollRangeHVSeq[] =
1614 {
1615 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1616 { WM_NCCALCSIZE, sent|wparam, 1 },
1617 { WM_GETTEXT, sent|defwinproc|optional },
1618 { WM_ERASEBKGND, sent|optional },
1619 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1620 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1621 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1622 { 0 }
1623 };
1624 /* SetScrollRange for a window with a non-client area */
1625 static const struct message WmSetScrollRangeHV_NC_Seq[] =
1626 {
1627 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE },
1628 { WM_NCCALCSIZE, sent|wparam, 1 },
1629 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
1630 { WM_NCPAINT, sent|optional },
1631 { WM_STYLECHANGING, sent|defwinproc|optional },
1632 { WM_STYLECHANGED, sent|defwinproc|optional },
1633 { WM_STYLECHANGING, sent|defwinproc|optional },
1634 { WM_STYLECHANGED, sent|defwinproc|optional },
1635 { WM_STYLECHANGING, sent|defwinproc|optional },
1636 { WM_STYLECHANGED, sent|defwinproc|optional },
1637 { WM_STYLECHANGING, sent|defwinproc|optional },
1638 { WM_STYLECHANGED, sent|defwinproc|optional },
1639 { WM_GETTEXT, sent|defwinproc|optional },
1640 { WM_GETTEXT, sent|defwinproc|optional },
1641 { WM_ERASEBKGND, sent|optional },
1642 { WM_CTLCOLORDLG, sent|defwinproc|optional }, /* sent to a parent of the dialog */
1643 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOCLIENTSIZE },
1644 { WM_SIZE, sent|defwinproc|optional },
1645 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1646 { EVENT_OBJECT_VALUECHANGE, winevent_hook|lparam|optional, 0/*OBJID_HSCROLL or OBJID_VSCROLL*/, 0 },
1647 { WM_GETTEXT, sent|optional },
1648 { WM_GETTEXT, sent|optional },
1649 { WM_GETTEXT, sent|optional },
1650 { WM_GETTEXT, sent|optional },
1651 { 0 }
1652 };
1653 /* test if we receive the right sequence of messages */
1654 /* after calling ShowWindow( SW_SHOWNA) */
1655 static const struct message WmSHOWNAChildInvisParInvis[] = {
1656 { WM_SHOWWINDOW, sent|wparam, 1 },
1657 { 0 }
1658 };
1659 static const struct message WmSHOWNAChildVisParInvis[] = {
1660 { WM_SHOWWINDOW, sent|wparam, 1 },
1661 { 0 }
1662 };
1663 static const struct message WmSHOWNAChildVisParVis[] = {
1664 { WM_SHOWWINDOW, sent|wparam, 1 },
1665 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1666 { 0 }
1667 };
1668 static const struct message WmSHOWNAChildInvisParVis[] = {
1669 { WM_SHOWWINDOW, sent|wparam, 1 },
1670 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1671 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1672 { WM_ERASEBKGND, sent|optional },
1673 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOACTIVATE|SWP_NOCLIENTMOVE },
1674 { 0 }
1675 };
1676 static const struct message WmSHOWNATopVisible[] = {
1677 { WM_SHOWWINDOW, sent|wparam, 1 },
1678 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
1679 { WM_NCPAINT, sent|wparam|optional, 1 },
1680 { WM_GETTEXT, sent|defwinproc|optional },
1681 { WM_ERASEBKGND, sent|optional },
1682 { WM_WINDOWPOSCHANGED, sent|optional },
1683 { 0 }
1684 };
1685 static const struct message WmSHOWNATopInvisible[] = {
1686 { WM_NOTIFYFORMAT, sent|optional },
1687 { WM_QUERYUISTATE, sent|optional },
1688 { WM_WINDOWPOSCHANGING, sent|optional },
1689 { WM_GETMINMAXINFO, sent|optional },
1690 { WM_NCCALCSIZE, sent|optional },
1691 { WM_WINDOWPOSCHANGED, sent|optional },
1692 { WM_SHOWWINDOW, sent|wparam, 1 },
1693 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
1694 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
1695 { WM_NCPAINT, sent|wparam|optional, 1 },
1696 { WM_GETTEXT, sent|defwinproc|optional },
1697 { WM_ERASEBKGND, sent|optional },
1698 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
1699 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
1700 { WM_NCPAINT, sent|wparam|optional, 1 },
1701 { WM_ERASEBKGND, sent|optional },
1702 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
1703 { WM_SIZE, sent|wparam, SIZE_RESTORED },
1704 { WM_MOVE, sent },
1705 { 0 }
1706 };
1707
1708 static int after_end_dialog, test_def_id;
1709 static int sequence_cnt, sequence_size;
1710 static struct recvd_message* sequence;
1711 static int log_all_parent_messages;
1712 static int paint_loop_done;
1713
1714 /* user32 functions */
1715 static HWND (WINAPI *pGetAncestor)(HWND,UINT);
1716 static BOOL (WINAPI *pGetMenuInfo)(HMENU,LPCMENUINFO);
1717 static void (WINAPI *pNotifyWinEvent)(DWORD, HWND, LONG, LONG);
1718 static BOOL (WINAPI *pSetMenuInfo)(HMENU,LPCMENUINFO);
1719 static HWINEVENTHOOK (WINAPI *pSetWinEventHook)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
1720 static BOOL (WINAPI *pTrackMouseEvent)(TRACKMOUSEEVENT*);
1721 static BOOL (WINAPI *pUnhookWinEvent)(HWINEVENTHOOK);
1722 static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
1723 static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
1724 static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
1725 static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC);
1726 static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR);
1727 /* kernel32 functions */
1728 static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA);
1729
1730 static void init_procs(void)
1731 {
1732 HMODULE user32 = GetModuleHandleA("user32.dll");
1733 HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
1734
1735 #define GET_PROC(dll, func) \
1736 p ## func = (void*)GetProcAddress(dll, #func); \
1737 if(!p ## func) { \
1738 trace("GetProcAddress(%s) failed\n", #func); \
1739 }
1740
1741 GET_PROC(user32, GetAncestor)
1742 GET_PROC(user32, GetMenuInfo)
1743 GET_PROC(user32, NotifyWinEvent)
1744 GET_PROC(user32, SetMenuInfo)
1745 GET_PROC(user32, SetWinEventHook)
1746 GET_PROC(user32, TrackMouseEvent)
1747 GET_PROC(user32, UnhookWinEvent)
1748 GET_PROC(user32, GetMonitorInfoA)
1749 GET_PROC(user32, MonitorFromPoint)
1750 GET_PROC(user32, UpdateLayeredWindow)
1751 GET_PROC(user32, SetSystemTimer)
1752 GET_PROC(user32, KillSystemTimer)
1753
1754 GET_PROC(kernel32, GetCPInfoExA)
1755
1756 #undef GET_PROC
1757 }
1758
1759 static const char *get_winpos_flags(UINT flags)
1760 {
1761 static char buffer[300];
1762
1763 buffer[0] = 0;
1764 #define DUMP(flag) do { if (flags & flag) { strcat( buffer, "|" #flag ); flags &= ~flag; } } while(0)
1765 DUMP( SWP_SHOWWINDOW );
1766 DUMP( SWP_HIDEWINDOW );
1767 DUMP( SWP_NOACTIVATE );
1768 DUMP( SWP_FRAMECHANGED );
1769 DUMP( SWP_NOCOPYBITS );
1770 DUMP( SWP_NOOWNERZORDER );
1771 DUMP( SWP_NOSENDCHANGING );
1772 DUMP( SWP_DEFERERASE );
1773 DUMP( SWP_ASYNCWINDOWPOS );
1774 DUMP( SWP_NOZORDER );
1775 DUMP( SWP_NOREDRAW );
1776 DUMP( SWP_NOSIZE );
1777 DUMP( SWP_NOMOVE );
1778 DUMP( SWP_NOCLIENTSIZE );
1779 DUMP( SWP_NOCLIENTMOVE );
1780 if (flags) sprintf(buffer + strlen(buffer),"|0x%04x", flags);
1781 return buffer + 1;
1782 #undef DUMP
1783 }
1784
1785 static BOOL ignore_message( UINT message )
1786 {
1787 /* these are always ignored */
1788 return (message >= 0xc000 ||
1789 message == WM_GETICON ||
1790 message == WM_GETOBJECT ||
1791 message == WM_TIMECHANGE ||
1792 message == WM_DISPLAYCHANGE ||
1793 message == WM_DEVICECHANGE ||
1794 message == WM_DWMNCRENDERINGCHANGED);
1795 }
1796
1797
1798 #define add_message(msg) add_message_(__LINE__,msg);
1799 static void add_message_(int line, const struct recvd_message *msg)
1800 {
1801 struct recvd_message *seq;
1802
1803 if (!sequence)
1804 {
1805 sequence_size = 10;
1806 sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) );
1807 }
1808 if (sequence_cnt == sequence_size)
1809 {
1810 sequence_size *= 2;
1811 sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence) );
1812 }
1813 assert(sequence);
1814
1815 seq = &sequence[sequence_cnt];
1816 seq->hwnd = msg->hwnd;
1817 seq->message = msg->message;
1818 seq->flags = msg->flags;
1819 seq->wParam = msg->wParam;
1820 seq->lParam = msg->lParam;
1821 seq->line = line;
1822 seq->descr = msg->descr;
1823 seq->output[0] = 0;
1824
1825 if (msg->descr)
1826 {
1827 if (msg->flags & hook)
1828 {
1829 static const char * const CBT_code_name[10] =
1830 {
1831 "HCBT_MOVESIZE",
1832 "HCBT_MINMAX",
1833 "HCBT_QS",
1834 "HCBT_CREATEWND",
1835 "HCBT_DESTROYWND",
1836 "HCBT_ACTIVATE",
1837 "HCBT_CLICKSKIPPED",
1838 "HCBT_KEYSKIPPED",
1839 "HCBT_SYSCOMMAND",
1840 "HCBT_SETFOCUS"
1841 };
1842 const char *code_name = (msg->message <= HCBT_SETFOCUS) ? CBT_code_name[msg->message] : "Unknown";
1843
1844 sprintf( seq->output, "%s: hook %d (%s) wp %08lx lp %08lx",
1845 msg->descr, msg->message, code_name, msg->wParam, msg->lParam );
1846 }
1847 else if (msg->flags & winevent_hook)
1848 {
1849 sprintf( seq->output, "%s: winevent %p %08x %08lx %08lx",
1850 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1851 }
1852 else
1853 {
1854 switch (msg->message)
1855 {
1856 case WM_WINDOWPOSCHANGING:
1857 case WM_WINDOWPOSCHANGED:
1858 {
1859 WINDOWPOS *winpos = (WINDOWPOS *)msg->lParam;
1860
1861 sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s",
1862 msg->descr, msg->hwnd,
1863 (msg->message == WM_WINDOWPOSCHANGING) ? "CHANGING" : "CHANGED",
1864 msg->wParam, msg->lParam, winpos->hwndInsertAfter,
1865 winpos->x, winpos->y, winpos->cx, winpos->cy,
1866 get_winpos_flags(winpos->flags) );
1867
1868 /* Log only documented flags, win2k uses 0x1000 and 0x2000
1869 * in the high word for internal purposes
1870 */
1871 seq->wParam = winpos->flags & 0xffff;
1872 /* We are not interested in the flags that don't match under XP and Win9x */
1873 seq->wParam &= ~SWP_NOZORDER;
1874 break;
1875 }
1876
1877 case WM_DRAWITEM:
1878 {
1879 DRAW_ITEM_STRUCT di;
1880 DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)msg->lParam;
1881
1882 sprintf( seq->output, "%s: %p WM_DRAWITEM: type %x, ctl_id %x, item_id %x, action %x, state %x",
1883 msg->descr, msg->hwnd, dis->CtlType, dis->CtlID,
1884 dis->itemID, dis->itemAction, dis->itemState);
1885
1886 di.u.lp = 0;
1887 di.u.item.type = dis->CtlType;
1888 di.u.item.ctl_id = dis->CtlID;
1889 if (dis->CtlType == ODT_LISTBOX ||
1890 dis->CtlType == ODT_COMBOBOX ||
1891 dis->CtlType == ODT_MENU)
1892 di.u.item.item_id = dis->itemID;
1893 di.u.item.action = dis->itemAction;
1894 di.u.item.state = dis->itemState;
1895
1896 seq->lParam = di.u.lp;
1897 break;
1898 }
1899 default:
1900 if (msg->message >= 0xc000) return; /* ignore registered messages */
1901 sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
1902 msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
1903 }
1904 if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
1905 sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags );
1906 }
1907 }
1908
1909 sequence_cnt++;
1910 }
1911
1912 /* try to make sure pending X events have been processed before continuing */
1913 static void flush_events(void)
1914 {
1915 MSG msg;
1916 int diff = 200;
1917 int min_timeout = 100;
1918 DWORD time = GetTickCount() + diff;
1919
1920 while (diff > 0)
1921 {
1922 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
1923 while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
1924 diff = time - GetTickCount();
1925 }
1926 }
1927
1928 static void flush_sequence(void)
1929 {
1930 HeapFree(GetProcessHeap(), 0, sequence);
1931 sequence = 0;
1932 sequence_cnt = sequence_size = 0;
1933 }
1934
1935 static void dump_sequence(const struct message *expected, const char *context, const char *file, int line)
1936 {
1937 const struct recvd_message *actual = sequence;
1938 unsigned int count = 0;
1939
1940 trace_(file, line)("Failed sequence %s:\n", context );
1941 while (expected->message && actual->message)
1942 {
1943 if (actual->output[0])
1944 {
1945 if (expected->flags & hook)
1946 {
1947 trace_(file, line)( " %u: expected: hook %04x - actual: %s\n",
1948 count, expected->message, actual->output );
1949 }
1950 else if (expected->flags & winevent_hook)
1951 {
1952 trace_(file, line)( " %u: expected: winevent %04x - actual: %s\n",
1953 count, expected->message, actual->output );
1954 }
1955 else if (expected->flags & kbd_hook)
1956 {
1957 trace_(file, line)( " %u: expected: kbd %04x - actual: %s\n",
1958 count, expected->message, actual->output );
1959 }
1960 else
1961 {
1962 trace_(file, line)( " %u: expected: msg %04x - actual: %s\n",
1963 count, expected->message, actual->output );
1964 }
1965 }
1966
1967 if (expected->message == actual->message)
1968 {
1969 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) &&
1970 (expected->flags & optional))
1971 {
1972 /* don't match messages if their defwinproc status differs */
1973 expected++;
1974 }
1975 else
1976 {
1977 expected++;
1978 actual++;
1979 }
1980 }
1981 /* silently drop winevent messages if there is no support for them */
1982 else if ((expected->flags & optional) || ((expected->flags & winevent_hook) && !hEvent_hook))
1983 expected++;
1984 else
1985 {
1986 expected++;
1987 actual++;
1988 }
1989 count++;
1990 }
1991
1992 /* optional trailing messages */
1993 while (expected->message && ((expected->flags & optional) ||
1994 ((expected->flags & winevent_hook) && !hEvent_hook)))
1995 {
1996 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
1997 expected++;
1998 count++;
1999 }
2000
2001 if (expected->message)
2002 {
2003 trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message );
2004 return;
2005 }
2006
2007 while (actual->message && actual->output[0])
2008 {
2009 trace_(file, line)( " %u: expected: nothing - actual: %s\n", count, actual->output );
2010 actual++;
2011 count++;
2012 }
2013 }
2014
2015 #define ok_sequence( exp, contx, todo) \
2016 ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__)
2017
2018
2019 static void ok_sequence_(const struct message *expected_list, const char *context, int todo,
2020 const char *file, int line)
2021 {
2022 static const struct recvd_message end_of_sequence;
2023 const struct message *expected = expected_list;
2024 const struct recvd_message *actual;
2025 int failcount = 0, dump = 0;
2026 unsigned int count = 0;
2027
2028 add_message(&end_of_sequence);
2029
2030 actual = sequence;
2031
2032 while (expected->message && actual->message)
2033 {
2034 if (expected->message == actual->message &&
2035 !((expected->flags ^ actual->flags) & (hook|winevent_hook|kbd_hook)))
2036 {
2037 if (expected->flags & wparam)
2038 {
2039 if (((expected->wParam ^ actual->wParam) & ~expected->wp_mask) && todo)
2040 {
2041 todo_wine {
2042 failcount ++;
2043 if (strcmp(winetest_platform, "wine")) dump++;
2044 ok_( file, line) (FALSE,
2045 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2046 context, count, expected->message, expected->wParam, actual->wParam);
2047 }
2048 }
2049 else
2050 {
2051 ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
2052 "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
2053 context, count, expected->message, expected->wParam, actual->wParam);
2054 if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
2055 }
2056
2057 }
2058 if (expected->flags & lparam)
2059 {
2060 if (((expected->lParam ^ actual->lParam) & ~expected->lp_mask) && todo)
2061 {
2062 todo_wine {
2063 failcount ++;
2064 if (strcmp(winetest_platform, "wine")) dump++;
2065 ok_( file, line) (FALSE,
2066 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2067 context, count, expected->message, expected->lParam, actual->lParam);
2068 }
2069 }
2070 else
2071 {
2072 ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
2073 "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
2074 context, count, expected->message, expected->lParam, actual->lParam);
2075 if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
2076 }
2077 }
2078 if ((expected->flags & optional) &&
2079 ((expected->flags ^ actual->flags) & (defwinproc|parent)))
2080 {
2081 /* don't match optional messages if their defwinproc or parent status differs */
2082 expected++;
2083 count++;
2084 continue;
2085 }
2086 if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
2087 {
2088 todo_wine {
2089 failcount ++;
2090 if (strcmp(winetest_platform, "wine")) dump++;
2091 ok_( file, line) (FALSE,
2092 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2093 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2094 }
2095 }
2096 else
2097 {
2098 ok_( file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
2099 "%s: %u: the msg 0x%04x should %shave been sent by DefWindowProc\n",
2100 context, count, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
2101 if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++;
2102 }
2103
2104 ok_( file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
2105 "%s: %u: the msg 0x%04x should %shave been sent by BeginPaint\n",
2106 context, count, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
2107 if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++;
2108
2109 ok_( file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
2110 "%s: %u: the msg 0x%04x should have been %s\n",
2111 context, count, expected->message, (expected->flags & posted) ? "posted" : "sent");
2112 if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++;
2113
2114 ok_( file, line) ((expected->flags & parent) == (actual->flags & parent),
2115 "%s: %u: the msg 0x%04x was expected in %s\n",
2116 context, count, expected->message, (expected->flags & parent) ? "parent" : "child");
2117 if ((expected->flags & parent) != (actual->flags & parent)) dump++;
2118
2119 ok_( file, line) ((expected->flags & hook) == (actual->flags & hook),
2120 "%s: %u: the msg 0x%04x should have been sent by a hook\n",
2121 context, count, expected->message);
2122 if ((expected->flags & hook) != (actual->flags & hook)) dump++;
2123
2124 ok_( file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
2125 "%s: %u: the msg 0x%04x should have been sent by a winevent hook\n",
2126 context, count, expected->message);
2127 if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++;
2128
2129 ok_( file, line) ((expected->flags & kbd_hook) == (actual->flags & kbd_hook),
2130 "%s: %u: the msg 0x%04x should have been sent by a keyboard hook\n",
2131 context, count, expected->message);
2132 if ((expected->flags & kbd_hook) != (actual->flags & kbd_hook)) dump++;
2133
2134 expected++;
2135 actual++;
2136 }
2137 /* silently drop hook messages if there is no support for them */
2138 else if ((expected->flags & optional) ||
2139 ((expected->flags & hook) && !hCBT_hook) ||
2140 ((expected->flags & winevent_hook) && !hEvent_hook) ||
2141 ((expected->flags & kbd_hook) && !hKBD_hook))
2142 expected++;
2143 else if (todo)
2144 {
2145 failcount++;
2146 todo_wine {
2147 if (strcmp(winetest_platform, "wine")) dump++;
2148 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2149 context, count, expected->message, actual->message);
2150 }
2151 goto done;
2152 }
2153 else
2154 {
2155 ok_( file, line) (FALSE, "%s: %u: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
2156 context, count, expected->message, actual->message);
2157 dump++;
2158 expected++;
2159 actual++;
2160 }
2161 count++;
2162 }
2163
2164 /* skip all optional trailing messages */
2165 while (expected->message && ((expected->flags & optional) ||
2166 ((expected->flags & hook) && !hCBT_hook) ||
2167 ((expected->flags & winevent_hook) && !hEvent_hook)))
2168 expected++;
2169
2170 if (todo)
2171 {
2172 todo_wine {
2173 if (expected->message || actual->message) {
2174 failcount++;
2175 if (strcmp(winetest_platform, "wine")) dump++;
2176 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2177 context, count, expected->message, actual->message);
2178 }
2179 }
2180 }
2181 else
2182 {
2183 if (expected->message || actual->message)
2184 {
2185 dump++;
2186 ok_( file, line) (FALSE, "%s: %u: the msg sequence is not complete: expected %04x - actual %04x\n",
2187 context, count, expected->message, actual->message);
2188 }
2189 }
2190 if( todo && !failcount) /* succeeded yet marked todo */
2191 todo_wine {
2192 if (!strcmp(winetest_platform, "wine")) dump++;
2193 ok_( file, line)( TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
2194 }
2195
2196 done:
2197 if (dump) dump_sequence(expected_list, context, file, line);
2198 flush_sequence();
2199 }
2200
2201 #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
2202
2203 /******************************** MDI test **********************************/
2204
2205 /* CreateWindow for MDI frame window, initially visible */
2206 static const struct message WmCreateMDIframeSeq[] = {
2207 { HCBT_CREATEWND, hook },
2208 { WM_GETMINMAXINFO, sent },
2209 { WM_NCCREATE, sent },
2210 { WM_NCCALCSIZE, sent|wparam, 0 },
2211 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 },
2212 { WM_CREATE, sent },
2213 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2214 { WM_NOTIFYFORMAT, sent|optional },
2215 { WM_QUERYUISTATE, sent|optional },
2216 { WM_WINDOWPOSCHANGING, sent|optional },
2217 { WM_GETMINMAXINFO, sent|optional },
2218 { WM_NCCALCSIZE, sent|optional },
2219 { WM_WINDOWPOSCHANGED, sent|optional },
2220 { WM_SHOWWINDOW, sent|wparam, 1 },
2221 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2222 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2223 { HCBT_ACTIVATE, hook },
2224 { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
2225 { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
2226 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* XP */
2227 { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, /* Win9x doesn't send it */
2228 { WM_NCACTIVATE, sent },
2229 { WM_GETTEXT, sent|defwinproc|optional },
2230 { WM_ACTIVATE, sent|wparam, 1 },
2231 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x */
2232 { HCBT_SETFOCUS, hook },
2233 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2234 { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 },
2235 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2236 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
2237 /* Win9x adds SWP_NOZORDER below */
2238 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2239 { WM_NCCALCSIZE, sent|wparam|optional, 1 }, /* XP */
2240 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2241 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2242 { WM_MOVE, sent },
2243 { 0 }
2244 };
2245 /* DestroyWindow for MDI frame window, initially visible */
2246 static const struct message WmDestroyMDIframeSeq[] = {
2247 { HCBT_DESTROYWND, hook },
2248 { 0x0090, sent|optional },
2249 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2250 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2251 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2252 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2253 { WM_NCACTIVATE, sent|wparam|optional, 0 }, /* XP */
2254 { WM_ACTIVATE, sent|wparam|optional, 0 }, /* Win9x */
2255 { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Win9x */
2256 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, OBJID_CARET, 0 },
2257 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2258 { WM_DESTROY, sent },
2259 { WM_NCDESTROY, sent },
2260 { 0 }
2261 };
2262 /* CreateWindow for MDI client window, initially visible */
2263 static const struct message WmCreateMDIclientSeq[] = {
2264 { HCBT_CREATEWND, hook },
2265 { WM_NCCREATE, sent },
2266 { WM_NCCALCSIZE, sent|wparam, 0 },
2267 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2268 { WM_CREATE, sent },
2269 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2270 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2271 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2272 { WM_MOVE, sent },
2273 { WM_PARENTNOTIFY, sent|wparam, WM_CREATE }, /* in MDI frame */
2274 { WM_SHOWWINDOW, sent|wparam, 1 },
2275 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2276 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2277 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2278 { 0 }
2279 };
2280 /* ShowWindow(SW_SHOW) for MDI client window */
2281 static const struct message WmShowMDIclientSeq[] = {
2282 { WM_SHOWWINDOW, sent|wparam, 1 },
2283 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2284 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2285 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2286 { 0 }
2287 };
2288 /* ShowWindow(SW_HIDE) for MDI client window */
2289 static const struct message WmHideMDIclientSeq[] = {
2290 { WM_SHOWWINDOW, sent|wparam, 0 },
2291 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2292 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam|optional, 0, 0 }, /* win2000 */
2293 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* XP */
2294 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2295 { 0 }
2296 };
2297 /* DestroyWindow for MDI client window, initially visible */
2298 static const struct message WmDestroyMDIclientSeq[] = {
2299 { HCBT_DESTROYWND, hook },
2300 { 0x0090, sent|optional },
2301 { WM_PARENTNOTIFY, sent|wparam, WM_DESTROY }, /* in MDI frame */
2302 { WM_SHOWWINDOW, sent|wparam, 0 },
2303 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2304 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2305 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2306 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2307 { WM_DESTROY, sent },
2308 { WM_NCDESTROY, sent },
2309 { 0 }
2310 };
2311 /* CreateWindow for MDI child window, initially visible */
2312 static const struct message WmCreateMDIchildVisibleSeq[] = {
2313 { HCBT_CREATEWND, hook },
2314 { WM_NCCREATE, sent },
2315 { WM_NCCALCSIZE, sent|wparam, 0 },
2316 { WM_CREATE, sent },
2317 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2318 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2319 { WM_MOVE, sent },
2320 /* Win2k sends wparam set to
2321 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2322 * while Win9x doesn't bother to set child window id according to
2323 * CLIENTCREATESTRUCT.idFirstChild
2324 */
2325 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2326 { WM_SHOWWINDOW, sent|wparam, 1 },
2327 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2328 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2329 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2330 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2331 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2332 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2333 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2334
2335 /* Win9x: message sequence terminates here. */
2336
2337 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2338 { HCBT_SETFOCUS, hook }, /* in MDI client */
2339 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2340 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2341 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2342 { WM_SETFOCUS, sent }, /* in MDI client */
2343 { HCBT_SETFOCUS, hook },
2344 { WM_KILLFOCUS, sent }, /* in MDI client */
2345 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2346 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2347 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2348 { WM_SETFOCUS, sent|defwinproc },
2349 { WM_MDIACTIVATE, sent|defwinproc },
2350 { 0 }
2351 };
2352 /* CreateWindow for MDI child window with invisible parent */
2353 static const struct message WmCreateMDIchildInvisibleParentSeq[] = {
2354 { HCBT_CREATEWND, hook },
2355 { WM_GETMINMAXINFO, sent },
2356 { WM_NCCREATE, sent },
2357 { WM_NCCALCSIZE, sent|wparam, 0 },
2358 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam|optional, 0, 0 },
2359 { WM_CREATE, sent },
2360 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2361 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2362 { WM_MOVE, sent },
2363 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2364 { WM_SHOWWINDOW, sent|wparam, 1 },
2365 { WM_MDIREFRESHMENU, sent }, /* in MDI client */
2366 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2367 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2368 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2369
2370 /* Win9x: message sequence terminates here. */
2371
2372 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2373 { HCBT_SETFOCUS, hook }, /* in MDI client */
2374 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2375 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2376 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2377 { WM_SETFOCUS, sent }, /* in MDI client */
2378 { HCBT_SETFOCUS, hook },
2379 { WM_KILLFOCUS, sent }, /* in MDI client */
2380 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2381 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2382 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2383 { WM_SETFOCUS, sent|defwinproc },
2384 { WM_MDIACTIVATE, sent|defwinproc },
2385 { 0 }
2386 };
2387 /* DestroyWindow for MDI child window, initially visible */
2388 static const struct message WmDestroyMDIchildVisibleSeq[] = {
2389 { HCBT_DESTROYWND, hook },
2390 /* Win2k sends wparam set to
2391 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2392 * while Win9x doesn't bother to set child window id according to
2393 * CLIENTCREATESTRUCT.idFirstChild
2394 */
2395 { 0x0090, sent|optional },
2396 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2397 { WM_SHOWWINDOW, sent|wparam, 0 },
2398 { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2399 { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 },
2400 { WM_ERASEBKGND, sent|parent|optional },
2401 { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2402
2403 /* { WM_DESTROY, sent }
2404 * Win9x: message sequence terminates here.
2405 */
2406
2407 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2408 { WM_KILLFOCUS, sent },
2409 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2410 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2411 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2412 { WM_SETFOCUS, sent }, /* in MDI client */
2413
2414 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2415 { WM_KILLFOCUS, sent }, /* in MDI client */
2416 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2417 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2418 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2419 { WM_SETFOCUS, sent }, /* in MDI client */
2420
2421 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2422
2423 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2424 { WM_KILLFOCUS, sent },
2425 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2426 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2427 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2428 { WM_SETFOCUS, sent }, /* in MDI client */
2429
2430 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2431 { WM_KILLFOCUS, sent }, /* in MDI client */
2432 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2433 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2434 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2435 { WM_SETFOCUS, sent }, /* in MDI client */
2436
2437 { WM_DESTROY, sent },
2438
2439 { HCBT_SETFOCUS, hook }, /* set focus to MDI client */
2440 { WM_KILLFOCUS, sent },
2441 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
2442 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2443 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2444 { WM_SETFOCUS, sent }, /* in MDI client */
2445
2446 { HCBT_SETFOCUS, hook }, /* MDI client sets focus back to MDI child */
2447 { WM_KILLFOCUS, sent }, /* in MDI client */
2448 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2449 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
2450 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2451 { WM_SETFOCUS, sent }, /* in MDI client */
2452
2453 { WM_NCDESTROY, sent },
2454 { 0 }
2455 };
2456 /* CreateWindow for MDI child window, initially invisible */
2457 static const struct message WmCreateMDIchildInvisibleSeq[] = {
2458 { HCBT_CREATEWND, hook },
2459 { WM_NCCREATE, sent },
2460 { WM_NCCALCSIZE, sent|wparam, 0 },
2461 { WM_CREATE, sent },
2462 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2463 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2464 { WM_MOVE, sent },
2465 /* Win2k sends wparam set to
2466 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2467 * while Win9x doesn't bother to set child window id according to
2468 * CLIENTCREATESTRUCT.idFirstChild
2469 */
2470 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2471 { 0 }
2472 };
2473 /* DestroyWindow for MDI child window, initially invisible */
2474 static const struct message WmDestroyMDIchildInvisibleSeq[] = {
2475 { HCBT_DESTROYWND, hook },
2476 /* Win2k sends wparam set to
2477 * MAKEWPARAM(WM_DESTROY, MDI_FIRST_CHILD_ID + nTotalCreated),
2478 * while Win9x doesn't bother to set child window id according to
2479 * CLIENTCREATESTRUCT.idFirstChild
2480 */
2481 { 0x0090, sent|optional },
2482 { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */
2483 { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 },
2484 { WM_DESTROY, sent },
2485 { WM_NCDESTROY, sent },
2486 /* FIXME: Wine destroys an icon/title window while Windows doesn't */
2487 { WM_PARENTNOTIFY, sent|wparam|optional, WM_DESTROY }, /* MDI client */
2488 { 0 }
2489 };
2490 /* CreateWindow for the 1st MDI child window, initially visible and maximized */
2491 static const struct message WmCreateMDIchildVisibleMaxSeq1[] = {
2492 { HCBT_CREATEWND, hook },
2493 { WM_NCCREATE, sent },
2494 { WM_NCCALCSIZE, sent|wparam, 0 },
2495 { WM_CREATE, sent },
2496 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2497 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2498 { WM_MOVE, sent },
2499 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2500 { WM_GETMINMAXINFO, sent },
2501 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2502 { WM_NCCALCSIZE, sent|wparam, 1 },
2503 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2504 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2505 /* in MDI frame */
2506 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2507 { WM_NCCALCSIZE, sent|wparam, 1 },
2508 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2509 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2510 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2511 /* Win2k sends wparam set to
2512 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2513 * while Win9x doesn't bother to set child window id according to
2514 * CLIENTCREATESTRUCT.idFirstChild
2515 */
2516 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2517 { WM_SHOWWINDOW, sent|wparam, 1 },
2518 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2519 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2520 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2521 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2522 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2523 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2524 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc|optional, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_FRAMECHANGED },
2525
2526 /* Win9x: message sequence terminates here. */
2527
2528 { WM_NCACTIVATE, sent|wparam|defwinproc|optional, 1 },
2529 { HCBT_SETFOCUS, hook|optional }, /* in MDI client */
2530 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2531 { WM_IME_NOTIFY, sent|wparam|optional, 2 }, /* in MDI client */
2532 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2533 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2534 { HCBT_SETFOCUS, hook|optional },
2535 { WM_KILLFOCUS, sent|optional }, /* in MDI client */
2536 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2537 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2538 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2539 { WM_SETFOCUS, sent|defwinproc|optional },
2540 { WM_MDIACTIVATE, sent|defwinproc|optional },
2541 /* in MDI frame */
2542 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2543 { WM_NCCALCSIZE, sent|wparam, 1 },
2544 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2545 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2546 { 0 }
2547 };
2548 /* CreateWindow for the 2nd MDI child window, initially visible and maximized */
2549 static const struct message WmCreateMDIchildVisibleMaxSeq2[] = {
2550 /* restore the 1st MDI child */
2551 { WM_SETREDRAW, sent|wparam, 0 },
2552 { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNORMAL },
2553 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED },
2554 { WM_NCCALCSIZE, sent|wparam, 1 },
2555 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2556 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2557 { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED },
2558 /* in MDI frame */
2559 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2560 { WM_NCCALCSIZE, sent|wparam, 1 },
2561 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2562 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2563 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2564 { WM_SETREDRAW, sent|wparam, 1 }, /* in the 1st MDI child */
2565 /* create the 2nd MDI child */
2566 { HCBT_CREATEWND, hook },
2567 { WM_NCCREATE, sent },
2568 { WM_NCCALCSIZE, sent|wparam, 0 },
2569 { WM_CREATE, sent },
2570 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2571 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2572 { WM_MOVE, sent },
2573 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2574 { WM_GETMINMAXINFO, sent },
2575 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2576 { WM_NCCALCSIZE, sent|wparam, 1 },
2577 { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2578 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2579 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2580 /* in MDI frame */
2581 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2582 { WM_NCCALCSIZE, sent|wparam, 1 },
2583 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2584 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2585 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2586 /* Win2k sends wparam set to
2587 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2588 * while Win9x doesn't bother to set child window id according to
2589 * CLIENTCREATESTRUCT.idFirstChild
2590 */
2591 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2592 { WM_SHOWWINDOW, sent|wparam, 1 },
2593 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2594 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2595 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2596 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2597 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2598 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2599
2600 { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, /* in the 1st MDI child */
2601 { WM_MDIACTIVATE, sent|defwinproc }, /* in the 1st MDI child */
2602
2603 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2604
2605 /* Win9x: message sequence terminates here. */
2606
2607 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2608 { HCBT_SETFOCUS, hook },
2609 { WM_KILLFOCUS, sent|defwinproc|optional }, /* in the 1st MDI child */
2610 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 0 }, /* in the 1st MDI child */
2611 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2612 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2613 { WM_SETFOCUS, sent }, /* in MDI client */
2614 { HCBT_SETFOCUS, hook },
2615 { WM_KILLFOCUS, sent }, /* in MDI client */
2616 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2617 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2618 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2619 { WM_SETFOCUS, sent|defwinproc },
2620
2621 { WM_MDIACTIVATE, sent|defwinproc },
2622 /* in MDI frame */
2623 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2624 { WM_NCCALCSIZE, sent|wparam, 1 },
2625 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2626 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2627 { 0 }
2628 };
2629 /* WM_MDICREATE MDI child window, initially visible and maximized */
2630 static const struct message WmCreateMDIchildVisibleMaxSeq3[] = {
2631 { WM_MDICREATE, sent },
2632 { HCBT_CREATEWND, hook },
2633 { WM_NCCREATE, sent },
2634 { WM_NCCALCSIZE, sent|wparam, 0 },
2635 { WM_CREATE, sent },
2636 { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 },
2637 { WM_SIZE, sent|wparam, SIZE_RESTORED },
2638 { WM_MOVE, sent },
2639 { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE },
2640 { WM_GETMINMAXINFO, sent },
2641 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_STATECHANGED },
2642 { WM_NCCALCSIZE, sent|wparam, 1 },
2643 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTMOVE|SWP_STATECHANGED },
2644 { WM_SIZE, sent|defwinproc|wparam, SIZE_MAXIMIZED },
2645
2646 /* in MDI frame */
2647 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2648 { WM_NCCALCSIZE, sent|wparam, 1 },
2649 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2650 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI frame */
2651 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, /* MDI child */
2652
2653 /* Win2k sends wparam set to
2654 * MAKEWPARAM(WM_CREATE, MDI_FIRST_CHILD_ID + nTotalCreated),
2655 * while Win9x doesn't bother to set child window id according to
2656 * CLIENTCREATESTRUCT.idFirstChild
2657 */
2658 { WM_PARENTNOTIFY, sent /*|wparam, WM_CREATE*/ }, /* in MDI client */
2659 { WM_SHOWWINDOW, sent|wparam, 1 },
2660 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2661
2662 { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 },
2663
2664 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2665 { WM_MDIREFRESHMENU, sent/*|wparam|lparam, 0, 0*/ },
2666 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE },
2667
2668 { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 },
2669 { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2670
2671 /* Win9x: message sequence terminates here. */
2672
2673 { WM_NCACTIVATE, sent|wparam|defwinproc, 1 },
2674 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2675 { HCBT_SETFOCUS, hook }, /* in MDI client */
2676 { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, /* in MDI client */
2677 { WM_IME_NOTIFY, sent|wparam|optional, 2 },
2678 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam|optional, OBJID_CLIENT, 0 },
2679 { WM_SETFOCUS, sent|optional }, /* in MDI client */
2680 { HCBT_SETFOCUS, hook|optional },
2681 { WM_KILLFOCUS, sent }, /* in MDI client */
2682 { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, /* in MDI client */
2683 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
2684 { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 },
2685 { WM_SETFOCUS, sent|defwinproc },
2686
2687 { WM_MDIACTIVATE, sent|defwinproc },
2688
2689 /* in MDI child */
2690 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2691 { WM_NCCALCSIZE, sent|wparam, 1 },
2692 { WM_WINDOWPOSCHANGED, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
2693 { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 },
2694
2695 /* in MDI frame */
2696 { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE },
2697 { WM_NCCALCSIZE, sent|wparam, 1 },
2698 { 0x0093, sen