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