1 /*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for CreateWindowEx
5 * PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
6 * Mark Jansen (mark.jansen@reactos.org)
7 */
8
9 #include "precomp.h"
10
Test_Params(void)11 static void Test_Params(void)
12 {
13 HWND hWnd;
14 DWORD dwError;
15
16 SetLastError(0x1234);
17 hWnd = CreateWindowExW(0, L"BUTTON", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
18 dwError = GetLastError();
19 ok(hWnd != NULL, "hWnd = %p\n", hWnd);
20 ok(dwError == 0, "error = %lu\n", dwError);
21 DestroyWindow(hWnd);
22
23 SetLastError(0x1234);
24 hWnd = CreateWindowExW(0, L"BUTTON", NULL, 0, 0, 0, 0, 0, (HWND)(LONG_PTR)-1, NULL, NULL, NULL);
25 dwError = GetLastError();
26 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
27 ok(dwError == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", dwError);
28
29 SetLastError(0x1234);
30 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_CHILD, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
31 dwError = GetLastError();
32 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
33 ok(dwError == ERROR_TLW_WITH_WSCHILD, "error = %lu\n", dwError);
34
35 SetLastError(0x1234);
36 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_CHILD, 0, 0, 0, 0, (HWND)(LONG_PTR)-1, NULL, NULL, NULL);
37 dwError = GetLastError();
38 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
39 ok(dwError == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", dwError);
40
41 SetLastError(0x1234);
42 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
43 dwError = GetLastError();
44 ok(hWnd != NULL, "hWnd = %p\n", hWnd);
45 ok(dwError == 0, "error = %lu\n", dwError);
46 DestroyWindow(hWnd);
47
48 SetLastError(0x1234);
49 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_POPUP, 0, 0, 0, 0, (HWND)(LONG_PTR)-1, NULL, NULL, NULL);
50 dwError = GetLastError();
51 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
52 ok(dwError == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", dwError);
53
54 SetLastError(0x1234);
55 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_CHILD|WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
56 dwError = GetLastError();
57 ok(hWnd != NULL, "hWnd = %p\n", hWnd);
58 ok(dwError == 0, "error = %lu\n", dwError);
59 DestroyWindow(hWnd);
60
61 SetLastError(0x1234);
62 hWnd = CreateWindowExW(0, L"BUTTON", NULL, WS_CHILD|WS_POPUP, 0, 0, 0, 0, (HWND)(LONG_PTR)-1, NULL, NULL, NULL);
63 dwError = GetLastError();
64 ok(hWnd == NULL, "hWnd = %p\n", hWnd);
65 ok(dwError == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", dwError);
66 }
67
68 static HWND g_TestWindow = NULL;
69 static HWND g_ChildWindow = NULL;
70 static HWND g_hwndMDIClient = NULL;
71
get_iwnd(HWND hWnd)72 static int get_iwnd(HWND hWnd)
73 {
74 if (!g_TestWindow)
75 g_TestWindow = hWnd;
76 if (!g_ChildWindow && hWnd != g_TestWindow)
77 g_ChildWindow = hWnd;
78
79 if (hWnd == g_TestWindow)
80 return 1;
81 else if (hWnd == g_ChildWindow)
82 return 2;
83 return 0;
84 }
85
86 static DWORD g_FaultLine = 0;
87 static DWORD g_NcExpectStyle = 0;
88 static DWORD g_NcExpectExStyle = 0;
89 static DWORD g_ExpectStyle = 0;
90 static DWORD g_ExpectExStyle = 0;
91
92 static DWORD g_ChildNcExpectStyle = 0;
93 static DWORD g_ChildNcExpectExStyle = 0;
94 static DWORD g_ChildExpectStyle = 0;
95 static DWORD g_ChildExpectExStyle = 0;
96
97 #undef ok_hex_
98 #define ok_hex_(expression, result) \
99 do { \
100 int _value = (expression); \
101 ok_(__FILE__, g_FaultLine)(_value == (result), "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x\n", \
102 #expression, (int)(result), _value); \
103 } while (0)
104
105
106
107 static int g_ChangeStyle = 0;
MSGTestProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)108 static LRESULT CALLBACK MSGTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
109 {
110 LRESULT lRet;
111 int iwnd = get_iwnd(hWnd);
112
113 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
114 return DefWindowProc(hWnd, message, wParam, lParam);
115
116 switch(message)
117 {
118 case WM_IME_SETCONTEXT:
119 case WM_IME_NOTIFY:
120 case WM_GETICON:
121 case WM_GETTEXT:
122 return DefWindowProc(hWnd, message, wParam, lParam);
123 break;
124 case WM_NCCREATE:
125 {
126 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
127 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
128 ok_hex_(create->style, g_NcExpectStyle);
129 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
130 if (g_ChangeStyle)
131 {
132 DWORD dwStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
133 dwStyle &= ~(WS_EX_CLIENTEDGE);
134 SetWindowLong(hWnd, GWL_EXSTYLE, dwStyle);
135 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
136 SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
137 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DRAWFRAME);
138
139 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
140 ok_hex_(create->style, g_NcExpectStyle);
141 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
142 }
143 }
144 break;
145 case WM_CREATE:
146 {
147 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
148 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
149 ok_hex_(create->style, g_ExpectStyle);
150 ok_hex_(create->dwExStyle, g_ExpectExStyle);
151 }
152 break;
153 case WM_NCCALCSIZE:
154 case WM_STYLECHANGING:
155 case WM_STYLECHANGED:
156 case WM_SIZE:
157 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
158 break;
159 case WM_WINDOWPOSCHANGING:
160 case WM_WINDOWPOSCHANGED:
161 ok(wParam == 0,"expected wParam=0\n");
162 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
163 break;
164 default:
165 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
166 break;
167 }
168 lRet = DefWindowProc(hWnd, message, wParam, lParam);
169 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
170 return lRet;
171 }
172
173 static MSG_ENTRY create_chain[] =
174 {
175 { 1, WM_GETMINMAXINFO, SENT },
176 { 1, WM_GETMINMAXINFO, SENT_RET },
177 { 1, WM_NCCREATE, SENT },
178 { 1, WM_NCCREATE, SENT_RET },
179 { 1, WM_NCCALCSIZE, SENT },
180 { 1, WM_NCCALCSIZE, SENT_RET },
181 { 1, WM_CREATE, SENT },
182 { 1, WM_CREATE, SENT_RET },
183 { 0, 0 }
184 };
185
186 static MSG_ENTRY create_chain_modify[] =
187 {
188 { 1, WM_GETMINMAXINFO, SENT },
189 { 1, WM_GETMINMAXINFO, SENT_RET },
190 { 1, WM_NCCREATE, SENT },
191 { 1, WM_STYLECHANGING, SENT, GWL_EXSTYLE },
192 { 1, WM_STYLECHANGING, SENT_RET },
193 { 1, WM_STYLECHANGED, SENT, GWL_EXSTYLE },
194 { 1, WM_STYLECHANGED, SENT_RET },
195 { 1, WM_NCCREATE, MARKER },
196 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED },
197 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
198 { 1, WM_NCCALCSIZE, SENT, TRUE },
199 { 1, WM_NCCALCSIZE, SENT_RET },
200 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_FRAMECHANGED },
201 { 1, WM_MOVE, SENT },
202 { 1, WM_MOVE, SENT_RET },
203 { 1, WM_SIZE, SENT },
204 { 1, WM_SIZE, SENT_RET },
205 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
206 { 1, WM_NCCREATE, MARKER },
207 { 1, WM_NCCREATE, SENT_RET },
208 { 1, WM_NCCALCSIZE, SENT },
209 { 1, WM_NCCALCSIZE, SENT_RET },
210 { 1, WM_CREATE, SENT },
211 { 1, WM_CREATE, SENT_RET },
212 { 0, 0 }
213 };
214
215 static MSG_ENTRY create_chain_modify_below8_nonsrv[] =
216 {
217 { 1, WM_GETMINMAXINFO, SENT },
218 { 1, WM_GETMINMAXINFO, SENT_RET },
219 { 1, WM_NCCREATE, SENT },
220 { 1, WM_STYLECHANGING, SENT, GWL_EXSTYLE },
221 { 1, WM_STYLECHANGING, SENT_RET },
222 { 1, WM_STYLECHANGED, SENT, GWL_EXSTYLE },
223 { 1, WM_STYLECHANGED, SENT_RET },
224 { 1, WM_NCCREATE, MARKER },
225 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED },
226 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
227 { 1, WM_NCCALCSIZE, SENT, TRUE },
228 { 1, WM_NCCALCSIZE, SENT_RET },
229 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_FRAMECHANGED },
230 { 1, WM_MOVE, SENT },
231 { 1, WM_MOVE, SENT_RET },
232 { 1, WM_SIZE, SENT },
233 { 1, WM_SIZE, SENT_RET },
234 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
235 { 1, WM_NCCALCSIZE, SENT, TRUE },
236 { 1, WM_NCCALCSIZE, SENT_RET },
237 { 1, WM_NCCREATE, MARKER },
238 { 1, WM_NCCREATE, SENT_RET },
239 { 1, WM_NCCALCSIZE, SENT },
240 { 1, WM_NCCALCSIZE, SENT_RET },
241 { 1, WM_CREATE, SENT },
242 { 1, WM_CREATE, SENT_RET },
243 { 0, 0 }
244 };
245
246
247 static BOOL
IsWindowsServer()248 IsWindowsServer()
249 {
250 OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0, 0, VER_NT_WORKSTATION };
251 DWORDLONG const dwlConditionMask = VerSetConditionMask( 0, VER_PRODUCT_TYPE, VER_EQUAL );
252
253 return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask);
254 }
255
256
257 static BOOL
IsWindows8OrGreater()258 IsWindows8OrGreater()
259 {
260 OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
261 DWORDLONG const dwlConditionMask = VerSetConditionMask(VerSetConditionMask(
262 VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
263 VER_MINORVERSION, VER_GREATER_EQUAL),
264 VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
265
266 osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_WIN8);
267 osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_WIN8);
268
269 return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
270 }
271
Test_Messages(void)272 static void Test_Messages(void)
273 {
274 HWND hWnd;
275 BOOL Below8NonServer = !IsWindows8OrGreater() && !IsWindowsServer();
276
277 RegisterSimpleClass(MSGTestProc, L"Test_Message_Window_XX");
278
279 g_ChangeStyle = 0;
280
281 g_ExpectStyle = g_NcExpectStyle = 0;
282 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
283 g_FaultLine = __LINE__ + 1;
284 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_XX", L"", 0, 10, 20,
285 200, 210, NULL, NULL, 0, NULL);
286
287 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
288 COMPARE_CACHE(create_chain);
289 DestroyWindow(hWnd);
290 g_TestWindow = g_ChildWindow = NULL;
291 EMPTY_CACHE();
292
293 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
294 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
295 g_FaultLine = __LINE__ + 1;
296 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_XX", L"", WS_OVERLAPPEDWINDOW, 10, 20,
297 200, 210, NULL, NULL, 0, NULL);
298
299 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
300 COMPARE_CACHE(create_chain);
301 DestroyWindow(hWnd);
302 g_TestWindow = g_ChildWindow = NULL;
303 EMPTY_CACHE();
304
305 g_ChangeStyle = 1;
306
307 g_ExpectStyle = g_NcExpectStyle = 0;
308 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
309 g_FaultLine = __LINE__ + 1;
310 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_XX", L"", 0, 10, 20,
311 200, 210, NULL, NULL, 0, NULL);
312
313 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
314 COMPARE_CACHE(Below8NonServer ? create_chain_modify_below8_nonsrv : create_chain_modify);
315 DestroyWindow(hWnd);
316 g_TestWindow = g_ChildWindow = NULL;
317 EMPTY_CACHE();
318
319 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
320 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
321 g_FaultLine = __LINE__ + 1;
322 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_XX", L"", WS_OVERLAPPEDWINDOW, 10, 20,
323 200, 210, NULL, NULL, 0, NULL);
324
325 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
326 COMPARE_CACHE(Below8NonServer ? create_chain_modify_below8_nonsrv : create_chain_modify);
327 DestroyWindow(hWnd);
328 g_TestWindow = g_ChildWindow = NULL;
329 EMPTY_CACHE();
330
331 UnregisterClassW(L"Test_Message_Window_XX", NULL);
332 }
333
334
MSGChildProc2(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)335 static LRESULT CALLBACK MSGChildProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
336 {
337 LRESULT lRet;
338 int iwnd = get_iwnd(hWnd);
339
340 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
341 return DefWindowProc(hWnd, message, wParam, lParam);
342
343 switch(message)
344 {
345 case WM_IME_SETCONTEXT:
346 case WM_IME_NOTIFY:
347 case WM_GETICON:
348 case WM_GETTEXT:
349 return DefWindowProc(hWnd, message, wParam, lParam);
350 break;
351 case WM_NCCREATE:
352 {
353 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
354 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
355 ok_hex_(create->style, g_ChildNcExpectStyle);
356 ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle);
357
358 if (g_ChangeStyle)
359 {
360 DWORD dwStyle = GetWindowLong(g_TestWindow, GWL_EXSTYLE);
361 dwStyle &= ~(WS_EX_CLIENTEDGE);
362 SetWindowLong(g_TestWindow, GWL_EXSTYLE, dwStyle);
363 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
364 SetWindowPos(g_TestWindow, NULL, 0, 0, 0, 0,
365 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DRAWFRAME);
366
367 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
368 ok_hex_(create->style, g_ChildNcExpectStyle);
369 ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle);
370 }
371 }
372 break;
373 case WM_CREATE:
374 {
375 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
376 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
377 ok_hex_(create->style, g_ChildExpectStyle);
378 ok_hex_(create->dwExStyle, g_ChildExpectExStyle);
379 }
380 break;
381 case WM_NCCALCSIZE:
382 case WM_STYLECHANGING:
383 case WM_STYLECHANGED:
384 case WM_SIZE:
385 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
386 break;
387 case WM_WINDOWPOSCHANGING:
388 case WM_WINDOWPOSCHANGED:
389 ok(wParam == 0,"expected wParam=0\n");
390 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
391 break;
392 default:
393 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
394 break;
395 }
396 lRet = DefWindowProc(hWnd, message, wParam, lParam);
397 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
398 return lRet;
399 }
400
401
MSGTestProc2(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)402 static LRESULT CALLBACK MSGTestProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
403 {
404 LRESULT lRet;
405 int iwnd = get_iwnd(hWnd);
406
407 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
408 return DefWindowProc(hWnd, message, wParam, lParam);
409
410 switch(message)
411 {
412 case WM_IME_SETCONTEXT:
413 case WM_IME_NOTIFY:
414 case WM_GETICON:
415 case WM_GETTEXT:
416 return DefWindowProc(hWnd, message, wParam, lParam);
417 break;
418 case WM_NCCREATE:
419 {
420 HWND child;
421 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
422 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
423 ok_hex_(create->style, g_NcExpectStyle);
424 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
425
426 child = CreateWindowExW(0, L"Test_Message_Window_Child2", L"", WS_CHILD, 0, 0, 10, 10, hWnd, NULL, 0, NULL);
427 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
428 ok_(__FILE__, g_FaultLine)(g_ChildWindow == child, "Testing against the wrong child!\n");
429 }
430 break;
431 case WM_NCDESTROY:
432 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
433 DestroyWindow(g_ChildWindow);
434 break;
435 case WM_CREATE:
436 {
437 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
438 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
439 ok_hex_(create->style, g_ExpectStyle);
440 ok_hex_(create->dwExStyle, g_ExpectExStyle);
441 }
442 break;
443 case WM_NCCALCSIZE:
444 case WM_STYLECHANGING:
445 case WM_STYLECHANGED:
446 case WM_SIZE:
447 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
448 break;
449 case WM_WINDOWPOSCHANGING:
450 case WM_WINDOWPOSCHANGED:
451 ok(wParam == 0,"expected wParam=0\n");
452 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
453 break;
454 default:
455 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
456 break;
457 }
458 lRet = DefWindowProc(hWnd, message, wParam, lParam);
459 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
460 return lRet;
461 }
462
463
464 MSG_ENTRY child_create_chain[] =
465 {
466 { 1, WM_GETMINMAXINFO, SENT },
467 { 1, WM_GETMINMAXINFO, SENT_RET },
468 { 1, WM_NCCREATE, SENT },
469 { 2, WM_NCCREATE, SENT },
470 { 2, WM_NCCREATE, SENT_RET },
471 { 2, WM_NCCALCSIZE, SENT },
472 { 2, WM_NCCALCSIZE, SENT_RET },
473 { 2, WM_CREATE, SENT },
474 { 2, WM_CREATE, SENT_RET },
475 { 2, WM_SIZE, SENT },
476 { 2, WM_SIZE, SENT_RET },
477 { 2, WM_MOVE, SENT },
478 { 2, WM_MOVE, SENT_RET },
479 { 1, WM_PARENTNOTIFY, SENT },
480 { 1, WM_PARENTNOTIFY, SENT_RET },
481 { 1, WM_NCCREATE, MARKER },
482 { 1, WM_NCCREATE, SENT_RET },
483 { 1, WM_NCCALCSIZE, SENT },
484 { 1, WM_NCCALCSIZE, SENT_RET },
485 { 1, WM_CREATE, SENT },
486 { 1, WM_CREATE, SENT_RET },
487 { 0, 0 }
488 };
489
490 MSG_ENTRY child_create_chain_modify[] =
491 {
492 { 1, WM_GETMINMAXINFO, SENT },
493 { 1, WM_GETMINMAXINFO, SENT_RET },
494 { 1, WM_NCCREATE, SENT },
495 { 2, WM_NCCREATE, SENT },
496 { 1, WM_STYLECHANGING, SENT, GWL_EXSTYLE },
497 { 1, WM_STYLECHANGING, SENT_RET },
498 { 1, WM_STYLECHANGED, SENT, GWL_EXSTYLE },
499 { 1, WM_STYLECHANGED, SENT_RET },
500 { 2, WM_NCCREATE, MARKER },
501 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED },
502 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
503 { 1, WM_NCCALCSIZE, SENT, TRUE },
504 { 1, WM_NCCALCSIZE, SENT_RET },
505 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_FRAMECHANGED },
506 { 1, WM_MOVE, SENT },
507 { 1, WM_MOVE, SENT_RET },
508 { 1, WM_SIZE, SENT },
509 { 1, WM_SIZE, SENT_RET },
510 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
511 { 2, WM_NCCREATE, MARKER },
512 { 2, WM_NCCREATE, SENT_RET },
513 { 2, WM_NCCALCSIZE, SENT },
514 { 2, WM_NCCALCSIZE, SENT_RET },
515 { 2, WM_CREATE, SENT },
516 { 2, WM_CREATE, SENT_RET },
517 { 2, WM_SIZE, SENT },
518 { 2, WM_SIZE, SENT_RET },
519 { 2, WM_MOVE, SENT },
520 { 2, WM_MOVE, SENT_RET },
521 { 1, WM_PARENTNOTIFY, SENT },
522 { 1, WM_PARENTNOTIFY, SENT_RET },
523 { 1, WM_NCCREATE, MARKER },
524 { 1, WM_NCCREATE, SENT_RET },
525 { 1, WM_NCCALCSIZE, SENT },
526 { 1, WM_NCCALCSIZE, SENT_RET },
527 { 1, WM_CREATE, SENT },
528 { 1, WM_CREATE, SENT_RET },
529 { 0, 0 }
530 };
531
532 MSG_ENTRY child_create_chain_modify_below8_nonsrv[] =
533 {
534 { 1, WM_GETMINMAXINFO, SENT },
535 { 1, WM_GETMINMAXINFO, SENT_RET },
536 { 1, WM_NCCREATE, SENT },
537 { 2, WM_NCCREATE, SENT },
538 { 1, WM_STYLECHANGING, SENT, GWL_EXSTYLE },
539 { 1, WM_STYLECHANGING, SENT_RET },
540 { 1, WM_STYLECHANGED, SENT, GWL_EXSTYLE },
541 { 1, WM_STYLECHANGED, SENT_RET },
542 { 2, WM_NCCREATE, MARKER },
543 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED },
544 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
545 { 1, WM_NCCALCSIZE, SENT, TRUE },
546 { 1, WM_NCCALCSIZE, SENT_RET },
547 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_FRAMECHANGED },
548 { 1, WM_MOVE, SENT },
549 { 1, WM_MOVE, SENT_RET },
550 { 1, WM_SIZE, SENT },
551 { 1, WM_SIZE, SENT_RET },
552 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
553 { 1, WM_NCCALCSIZE, SENT, TRUE },
554 { 1, WM_NCCALCSIZE, SENT_RET },
555 { 2, WM_NCCREATE, MARKER },
556 { 2, WM_NCCREATE, SENT_RET },
557 { 2, WM_NCCALCSIZE, SENT },
558 { 2, WM_NCCALCSIZE, SENT_RET },
559 { 2, WM_CREATE, SENT },
560 { 2, WM_CREATE, SENT_RET },
561 { 2, WM_SIZE, SENT },
562 { 2, WM_SIZE, SENT_RET },
563 { 2, WM_MOVE, SENT },
564 { 2, WM_MOVE, SENT_RET },
565 { 1, WM_PARENTNOTIFY, SENT },
566 { 1, WM_PARENTNOTIFY, SENT_RET },
567 { 1, WM_NCCREATE, MARKER },
568 { 1, WM_NCCREATE, SENT_RET },
569 { 1, WM_NCCALCSIZE, SENT },
570 { 1, WM_NCCALCSIZE, SENT_RET },
571 { 1, WM_CREATE, SENT },
572 { 1, WM_CREATE, SENT_RET },
573 { 0, 0 }
574 };
575
576
577
Test_Messages_Child(void)578 static void Test_Messages_Child(void)
579 {
580 HWND hWnd;
581 BOOL Below8NonServer = !IsWindows8OrGreater() && !IsWindowsServer();
582
583 RegisterSimpleClass(MSGTestProc2, L"Test_Message_Window_X2");
584 RegisterSimpleClass(MSGChildProc2, L"Test_Message_Window_Child2");
585
586 g_ChangeStyle = 0;
587
588 g_ExpectStyle = g_NcExpectStyle = 0;
589 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
590 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD;
591 g_ChildExpectExStyle = g_ChildNcExpectExStyle = 0;
592 g_FaultLine = __LINE__ + 1;
593 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_X2", L"", 0, 10, 20,
594 200, 210, NULL, NULL, 0, NULL);
595
596 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
597 COMPARE_CACHE(child_create_chain);
598 DestroyWindow(hWnd);
599 g_TestWindow = g_ChildWindow = NULL;
600 EMPTY_CACHE();
601
602 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
603 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
604 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD;
605 g_ChildExpectExStyle = g_ChildNcExpectExStyle = 0;
606 g_FaultLine = __LINE__ + 1;
607 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_X2", L"", WS_OVERLAPPEDWINDOW, 10, 20,
608 200, 210, NULL, NULL, 0, NULL);
609
610 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
611 COMPARE_CACHE(child_create_chain);
612 DestroyWindow(hWnd);
613 g_TestWindow = g_ChildWindow = NULL;
614 EMPTY_CACHE();
615
616 g_ChangeStyle = 1;
617
618 g_ExpectStyle = g_NcExpectStyle = 0;
619 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
620 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD;
621 g_ChildExpectExStyle = g_ChildNcExpectExStyle = 0;
622 g_FaultLine = __LINE__ + 1;
623 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_X2", L"", 0, 10, 20,
624 200, 210, NULL, NULL, 0, NULL);
625
626 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
627 COMPARE_CACHE(Below8NonServer ? child_create_chain_modify_below8_nonsrv : child_create_chain_modify);
628 DestroyWindow(hWnd);
629 g_TestWindow = g_ChildWindow = NULL;
630 EMPTY_CACHE();
631
632 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
633 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
634 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD;
635 g_ChildExpectExStyle = g_ChildNcExpectExStyle = 0;
636 g_FaultLine = __LINE__ + 1;
637 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_X2", L"", WS_OVERLAPPEDWINDOW, 10, 20,
638 200, 210, NULL, NULL, 0, NULL);
639
640 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
641 COMPARE_CACHE(Below8NonServer ? child_create_chain_modify_below8_nonsrv : child_create_chain_modify);
642 DestroyWindow(hWnd);
643 g_TestWindow = g_ChildWindow = NULL;
644 EMPTY_CACHE();
645
646 UnregisterClassW(L"Test_Message_Window_X2", NULL);
647 UnregisterClassW(L"Test_Message_Window_Child2", NULL);
648 }
649
650
651
MSGTestProcMDI(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)652 static LRESULT CALLBACK MSGTestProcMDI(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
653 {
654 LRESULT lRet;
655 int iwnd = get_iwnd(hWnd);
656
657 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
658 return DefWindowProc(hWnd, message, wParam, lParam);
659
660 switch(message)
661 {
662 case WM_IME_SETCONTEXT:
663 case WM_IME_NOTIFY:
664 case WM_GETICON:
665 case WM_GETTEXT:
666 return DefWindowProc(hWnd, message, wParam, lParam);
667 break;
668 case WM_NCCREATE:
669 {
670 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
671 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
672 ok_hex_(create->style, g_NcExpectStyle);
673 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
674 }
675 break;
676 case WM_CREATE:
677 {
678 CLIENTCREATESTRUCT ccs = { 0 };
679 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
680 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
681 ok_hex_(create->style, g_ExpectStyle);
682 ok_hex_(create->dwExStyle, g_ExpectExStyle);
683
684 g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL,
685 WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
686 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs);
687
688 ShowWindow(g_hwndMDIClient, SW_SHOW);
689
690 }
691 break;
692 case WM_NCCALCSIZE:
693 case WM_STYLECHANGING:
694 case WM_STYLECHANGED:
695 case WM_SIZE:
696 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
697 break;
698 case WM_WINDOWPOSCHANGING:
699 case WM_WINDOWPOSCHANGED:
700 ok(wParam == 0,"expected wParam=0\n");
701 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
702 break;
703 default:
704 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
705 break;
706 }
707 lRet = DefWindowProc(hWnd, message, wParam, lParam);
708 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
709 return lRet;
710 }
711
712 MSG_ENTRY create_chain_MDI[] =
713 {
714 { 1, WM_GETMINMAXINFO, SENT },
715 { 1, WM_GETMINMAXINFO, SENT_RET },
716 { 1, WM_NCCREATE, SENT },
717 { 1, WM_NCCREATE, SENT_RET },
718 { 1, WM_NCCALCSIZE, SENT },
719 { 1, WM_NCCALCSIZE, SENT_RET },
720 { 1, WM_CREATE, SENT },
721 { 1, WM_PARENTNOTIFY, SENT },
722 { 1, WM_PARENTNOTIFY, SENT_RET },
723 { 1, WM_CREATE, SENT_RET },
724 { 0, 0 }
725 };
726
Test_Messages_MDI(void)727 static void Test_Messages_MDI(void)
728 {
729 HWND hWnd;
730
731 RegisterSimpleClass(MSGTestProcMDI, L"Test_Message_Window_MDI_XX");
732
733 g_ExpectStyle = g_NcExpectStyle = 0;
734 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
735 g_FaultLine = __LINE__ + 1;
736 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", L"", 0, 10, 20,
737 200, 210, NULL, NULL, 0, NULL);
738
739 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
740 COMPARE_CACHE(create_chain_MDI);
741 DestroyWindow(hWnd);
742 g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL;
743 EMPTY_CACHE();
744
745 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
746 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
747 g_FaultLine = __LINE__ + 1;
748 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", L"", WS_OVERLAPPEDWINDOW, 10, 20,
749 200, 210, NULL, NULL, 0, NULL);
750
751 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
752 COMPARE_CACHE(create_chain_MDI);
753 DestroyWindow(hWnd);
754 g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL;
755 EMPTY_CACHE();
756
757 UnregisterClassW(L"Test_Message_Window_MDI_XX", NULL);
758 }
759
760
MSGTestProcMDI2(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)761 static LRESULT CALLBACK MSGTestProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
762 {
763 LRESULT lRet;
764 int iwnd = get_iwnd(hWnd);
765
766 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
767 return DefWindowProc(hWnd, message, wParam, lParam);
768
769 switch(message)
770 {
771 case WM_IME_SETCONTEXT:
772 case WM_IME_NOTIFY:
773 case WM_GETICON:
774 case WM_GETTEXT:
775 return DefWindowProc(hWnd, message, wParam, lParam);
776 break;
777 case WM_NCCREATE:
778 {
779 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
780 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
781 ok_hex_(create->style, g_NcExpectStyle);
782 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
783 }
784 break;
785 case WM_CREATE:
786 {
787 MDICREATESTRUCT mcs = {0};
788 CLIENTCREATESTRUCT ccs = { 0 };
789 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
790 HWND hchild;
791 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
792 ok_hex_(create->style, g_ExpectStyle);
793 ok_hex_(create->dwExStyle, g_ExpectExStyle);
794
795
796 g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL,
797 WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
798 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs);
799
800 ShowWindow(g_hwndMDIClient, SW_SHOW);
801
802
803 mcs.szClass = "Test_Message_MDI_Window_Child2";
804 mcs.x = mcs.cx = CW_USEDEFAULT;
805 mcs.y = mcs.cy = CW_USEDEFAULT;
806 mcs.style = WS_MAXIMIZE;
807
808 hchild = (HWND) SendMessage (g_hwndMDIClient, WM_MDICREATE, 0,
809 (LPARAM)&mcs);
810 ok(hchild == g_ChildWindow, "We are testing with %p instead of %p\n", g_ChildWindow, hchild);
811
812 }
813 break;
814 case WM_NCCALCSIZE:
815 case WM_STYLECHANGING:
816 case WM_STYLECHANGED:
817 case WM_SIZE:
818 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
819 break;
820 case WM_WINDOWPOSCHANGING:
821 case WM_WINDOWPOSCHANGED:
822 ok(wParam == 0,"expected wParam=0\n");
823 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
824 break;
825 default:
826 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
827 break;
828 }
829 lRet = DefWindowProc(hWnd, message, wParam, lParam);
830 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
831 return lRet;
832 }
833
MSGChildProcMDI2(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)834 static LRESULT CALLBACK MSGChildProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
835 {
836 LRESULT lRet;
837 int iwnd = get_iwnd(hWnd);
838
839 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
840 return DefMDIChildProc(hWnd, message, wParam, lParam);
841
842 switch(message)
843 {
844 case WM_IME_SETCONTEXT:
845 case WM_IME_NOTIFY:
846 case WM_GETICON:
847 case WM_GETTEXT:
848 return DefMDIChildProc(hWnd, message, wParam, lParam);
849 break;
850 case WM_NCCREATE:
851 {
852 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
853 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
854 ok_hex_(create->style, g_ChildNcExpectStyle);
855 ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle);
856 }
857 break;
858 case WM_CREATE:
859 {
860 LPCREATESTRUCT create = (LPCREATESTRUCT)lParam;
861 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
862 ok_hex_(create->style, g_ChildExpectStyle);
863 ok_hex_(create->dwExStyle, g_ChildExpectExStyle);
864 }
865 break;
866 case WM_NCCALCSIZE:
867 case WM_STYLECHANGING:
868 case WM_STYLECHANGED:
869 case WM_SIZE:
870 RECORD_MESSAGE(iwnd, message, SENT, wParam, 0);
871 break;
872 case WM_WINDOWPOSCHANGING:
873 case WM_WINDOWPOSCHANGED:
874 ok(wParam == 0,"expected wParam=0\n");
875 RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0);
876 break;
877 default:
878 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
879 break;
880 }
881 lRet = DefMDIChildProc(hWnd, message, wParam, lParam);
882 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
883 return lRet;
884 }
885
886
887 static MSG_ENTRY child_create_chain_MDI[] =
888 {
889 { 1, WM_GETMINMAXINFO, SENT },
890 { 1, WM_GETMINMAXINFO, SENT_RET },
891 { 1, WM_NCCREATE, SENT },
892 { 1, WM_NCCREATE, SENT_RET },
893 { 1, WM_NCCALCSIZE, SENT },
894 { 1, WM_NCCALCSIZE, SENT_RET },
895 { 1, WM_CREATE, SENT },
896 { 1, WM_PARENTNOTIFY, SENT },
897 { 1, WM_PARENTNOTIFY, SENT_RET },
898 { 2, WM_GETMINMAXINFO, SENT },
899 { 2, WM_GETMINMAXINFO, SENT_RET },
900 { 2, WM_NCCREATE, SENT },
901 { 2, WM_NCCREATE, SENT_RET },
902 { 2, WM_NCCALCSIZE, SENT },
903 { 2, WM_NCCALCSIZE, SENT_RET },
904 { 2, WM_CREATE, SENT },
905 { 2, WM_CREATE, SENT_RET },
906 { 2, WM_SIZE, SENT },
907 { 2, WM_SIZE, SENT_RET },
908 { 2, WM_MOVE, SENT },
909 { 2, WM_MOVE, SENT_RET },
910 { 2, WM_GETMINMAXINFO, SENT },
911 { 2, WM_GETMINMAXINFO, SENT_RET },
912 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 },
913 { 2, WM_GETMINMAXINFO, SENT },
914 { 2, WM_GETMINMAXINFO, SENT_RET },
915 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
916 { 2, WM_NCCALCSIZE, SENT, 1 },
917 { 2, WM_NCCALCSIZE, SENT_RET },
918 { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 },
919 { 2, WM_MOVE, SENT },
920 { 2, WM_MOVE, SENT_RET },
921 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
922 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE },
923 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
924 { 1, WM_NCCALCSIZE, SENT, TRUE },
925 { 1, WM_NCCALCSIZE, SENT_RET },
926 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
927 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
928 { 2, WM_SIZE, SENT_RET },
929 { 2, WM_WINDOWPOSCHANGED, SENT_RET },
930 { 2, WM_NCCALCSIZE, SENT, TRUE },
931 { 2, WM_NCCALCSIZE, SENT_RET },
932 { 2, WM_SHOWWINDOW, SENT },
933 { 2, WM_SHOWWINDOW, SENT_RET },
934 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE },
935 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
936 { 2, WM_CHILDACTIVATE, SENT },
937 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE },
938 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
939 { 2, WM_MDIACTIVATE, SENT },
940 { 2, WM_MDIACTIVATE, SENT_RET },
941 { 2, WM_CHILDACTIVATE, SENT_RET },
942 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED },
943 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
944 { 1, WM_NCCALCSIZE, SENT, TRUE },
945 { 1, WM_NCCALCSIZE, SENT_RET },
946 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
947 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
948 { 1, WM_CREATE, SENT_RET },
949 { 0, 0 },
950 };
951
952 static MSG_ENTRY child_create_chain_MDI_below8[] =
953 {
954 { 1, WM_GETMINMAXINFO, SENT },
955 { 1, WM_GETMINMAXINFO, SENT_RET },
956 { 1, WM_NCCREATE, SENT },
957 { 1, WM_NCCREATE, SENT_RET },
958 { 1, WM_NCCALCSIZE, SENT },
959 { 1, WM_NCCALCSIZE, SENT_RET },
960 { 1, WM_CREATE, SENT },
961 { 1, WM_PARENTNOTIFY, SENT },
962 { 1, WM_PARENTNOTIFY, SENT_RET },
963 { 2, WM_GETMINMAXINFO, SENT },
964 { 2, WM_GETMINMAXINFO, SENT_RET },
965 { 2, WM_NCCREATE, SENT },
966 { 2, WM_NCCREATE, SENT_RET },
967 { 2, WM_NCCALCSIZE, SENT },
968 { 2, WM_NCCALCSIZE, SENT_RET },
969 { 2, WM_CREATE, SENT },
970 { 2, WM_CREATE, SENT_RET },
971 { 2, WM_SIZE, SENT },
972 { 2, WM_SIZE, SENT_RET },
973 { 2, WM_MOVE, SENT },
974 { 2, WM_MOVE, SENT_RET },
975 { 2, WM_GETMINMAXINFO, SENT },
976 { 2, WM_GETMINMAXINFO, SENT_RET },
977 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 },
978 { 2, WM_GETMINMAXINFO, SENT },
979 { 2, WM_GETMINMAXINFO, SENT_RET },
980 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
981 { 2, WM_NCCALCSIZE, SENT, 1 },
982 { 2, WM_NCCALCSIZE, SENT_RET },
983 { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 },
984 { 2, WM_MOVE, SENT },
985 { 2, WM_MOVE, SENT_RET },
986 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
987 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE },
988 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
989 { 1, WM_NCCALCSIZE, SENT, TRUE },
990 { 1, WM_NCCALCSIZE, SENT_RET },
991 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
992 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
993 { 2, WM_SIZE, SENT_RET },
994 { 2, WM_WINDOWPOSCHANGED, SENT_RET },
995 //{ 2, WM_NCCALCSIZE, SENT, TRUE },
996 //{ 2, WM_NCCALCSIZE, SENT_RET },
997 { 2, WM_SHOWWINDOW, SENT },
998 { 2, WM_SHOWWINDOW, SENT_RET },
999 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE },
1000 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
1001 { 2, WM_CHILDACTIVATE, SENT },
1002 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE },
1003 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
1004 { 2, WM_MDIACTIVATE, SENT },
1005 { 2, WM_MDIACTIVATE, SENT_RET },
1006 { 2, WM_CHILDACTIVATE, SENT_RET },
1007 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED },
1008 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
1009 { 1, WM_NCCALCSIZE, SENT, TRUE },
1010 { 1, WM_NCCALCSIZE, SENT_RET },
1011 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
1012 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
1013 { 1, WM_CREATE, SENT_RET },
1014 { 0, 0 },
1015 };
1016
1017 static MSG_ENTRY child_create_chain_MDI_below8_nonsrv[] =
1018 {
1019 { 1, WM_GETMINMAXINFO, SENT },
1020 { 1, WM_GETMINMAXINFO, SENT_RET },
1021 { 1, WM_NCCREATE, SENT },
1022 { 1, WM_NCCREATE, SENT_RET },
1023 { 1, WM_NCCALCSIZE, SENT },
1024 { 1, WM_NCCALCSIZE, SENT_RET },
1025 { 1, WM_CREATE, SENT },
1026 { 1, WM_PARENTNOTIFY, SENT },
1027 { 1, WM_PARENTNOTIFY, SENT_RET },
1028 { 2, WM_GETMINMAXINFO, SENT },
1029 { 2, WM_GETMINMAXINFO, SENT_RET },
1030 { 2, WM_NCCREATE, SENT },
1031 { 2, WM_NCCREATE, SENT_RET },
1032 { 2, WM_NCCALCSIZE, SENT },
1033 { 2, WM_NCCALCSIZE, SENT_RET },
1034 { 2, WM_CREATE, SENT },
1035 { 2, WM_CREATE, SENT_RET },
1036 { 2, WM_SIZE, SENT },
1037 { 2, WM_SIZE, SENT_RET },
1038 { 2, WM_MOVE, SENT },
1039 { 2, WM_MOVE, SENT_RET },
1040 { 2, WM_GETMINMAXINFO, SENT },
1041 { 2, WM_GETMINMAXINFO, SENT_RET },
1042 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 },
1043 { 2, WM_GETMINMAXINFO, SENT },
1044 { 2, WM_GETMINMAXINFO, SENT_RET },
1045 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
1046 { 2, WM_NCCALCSIZE, SENT, 1 },
1047 { 2, WM_NCCALCSIZE, SENT_RET },
1048 { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 },
1049 { 2, WM_MOVE, SENT },
1050 { 2, WM_MOVE, SENT_RET },
1051 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
1052 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE },
1053 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
1054 { 1, WM_NCCALCSIZE, SENT, TRUE },
1055 { 1, WM_NCCALCSIZE, SENT_RET },
1056 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
1057 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
1058 // +
1059 { 1, WM_NCCALCSIZE, SENT, TRUE },
1060 { 1, WM_NCCALCSIZE, SENT_RET },
1061 // -
1062 { 2, WM_SIZE, SENT_RET },
1063 { 2, WM_WINDOWPOSCHANGED, SENT_RET },
1064 { 2, WM_NCCALCSIZE, SENT, TRUE },
1065 { 2, WM_NCCALCSIZE, SENT_RET },
1066 { 2, WM_SHOWWINDOW, SENT },
1067 { 2, WM_SHOWWINDOW, SENT_RET },
1068 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE },
1069 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
1070 { 2, WM_CHILDACTIVATE, SENT },
1071 { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE },
1072 { 2, WM_WINDOWPOSCHANGING, SENT_RET },
1073 { 2, WM_MDIACTIVATE, SENT },
1074 { 2, WM_MDIACTIVATE, SENT_RET },
1075 { 2, WM_CHILDACTIVATE, SENT_RET },
1076 { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED },
1077 { 1, WM_WINDOWPOSCHANGING, SENT_RET },
1078 { 1, WM_NCCALCSIZE, SENT, TRUE },
1079 { 1, WM_NCCALCSIZE, SENT_RET },
1080 { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 },
1081 { 1, WM_WINDOWPOSCHANGED, SENT_RET },
1082 { 1, WM_CREATE, SENT_RET },
1083 { 0, 0 },
1084 };
1085
Test_Messages_MDI_Child(void)1086 static void Test_Messages_MDI_Child(void)
1087 {
1088 HWND hWnd;
1089
1090 BOOL Below8 = !IsWindows8OrGreater();
1091 BOOL Below8NonServer = !IsWindows8OrGreater() && !IsWindowsServer();
1092
1093 RegisterSimpleClass(MSGTestProcMDI2, L"Test_Message_MDI_Window_X2");
1094 RegisterSimpleClass(MSGChildProcMDI2, L"Test_Message_MDI_Window_Child2");
1095
1096 g_ExpectStyle = g_NcExpectStyle = 0;
1097 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE;
1098 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_MAXIMIZE | WS_OVERLAPPEDWINDOW;
1099 g_ChildExpectExStyle = g_ChildNcExpectExStyle = WS_EX_WINDOWEDGE | WS_EX_MDICHILD;
1100 g_FaultLine = __LINE__ + 1;
1101 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_MDI_Window_X2", L"", 0, 10, 20,
1102 200, 210, NULL, NULL, 0, NULL);
1103
1104 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
1105 COMPARE_CACHE(Below8NonServer ? (child_create_chain_MDI_below8_nonsrv) : (Below8 ? child_create_chain_MDI_below8 : child_create_chain_MDI));
1106 DestroyWindow(hWnd);
1107 g_TestWindow = g_ChildWindow = NULL;
1108 EMPTY_CACHE();
1109
1110 g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW;
1111 g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW;
1112 g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_MAXIMIZE | WS_OVERLAPPEDWINDOW;
1113 g_ChildExpectExStyle = g_ChildNcExpectExStyle = WS_EX_WINDOWEDGE | WS_EX_MDICHILD;
1114 g_FaultLine = __LINE__ + 1;
1115 hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_MDI_Window_X2", L"", WS_OVERLAPPEDWINDOW, 10, 20,
1116 200, 210, NULL, NULL, 0, NULL);
1117
1118 ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd);
1119 COMPARE_CACHE(Below8NonServer ? (child_create_chain_MDI_below8_nonsrv) : (Below8 ? child_create_chain_MDI_below8 : child_create_chain_MDI));
1120 DestroyWindow(hWnd);
1121 g_TestWindow = g_ChildWindow = NULL;
1122 EMPTY_CACHE();
1123
1124 UnregisterClassW(L"Test_Message_Window_X2", NULL);
1125 UnregisterClassW(L"Test_Message_MDI_Window_Child2", NULL);
1126 }
1127
1128
START_TEST(CreateWindowEx)1129 START_TEST(CreateWindowEx)
1130 {
1131 Test_Params();
1132 Test_Messages();
1133 Test_Messages_Child();
1134 Test_Messages_MDI();
1135 Test_Messages_MDI_Child();
1136 }
1137