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