ReactOS 0.4.15-dev-7931-gfd331f1
CreateWindowEx.c
Go to the documentation of this file.
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
11static 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);
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);
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);
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
71
72static int get_iwnd(HWND hWnd)
73{
74 if (!g_TestWindow)
78
79 if (hWnd == g_TestWindow)
80 return 1;
81 else if (hWnd == g_ChildWindow)
82 return 2;
83 return 0;
84}
85
86static DWORD g_FaultLine = 0;
91
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
107static int g_ChangeStyle = 0;
109{
110 LRESULT lRet;
111 int iwnd = get_iwnd(hWnd);
112
113 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
115
116 switch(message)
117 {
119 case WM_IME_NOTIFY:
120 case WM_GETICON:
121 case WM_GETTEXT:
123 break;
124 case WM_NCCREATE:
125 {
127 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
129 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
130 if (g_ChangeStyle)
131 {
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,
138
139 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
141 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
142 }
143 }
144 break;
145 case WM_CREATE:
146 {
148 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
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;
161 ok(wParam == 0,"expected wParam=0\n");
163 break;
164 default:
165 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
166 break;
167 }
169 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
170 return lRet;
171}
172
174{
175 { 1, WM_GETMINMAXINFO, SENT },
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
187{
188 { 1, WM_GETMINMAXINFO, SENT },
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 },
198 { 1, WM_NCCALCSIZE, SENT, TRUE },
199 { 1, WM_NCCALCSIZE, SENT_RET },
201 { 1, WM_MOVE, SENT },
202 { 1, WM_MOVE, SENT_RET },
203 { 1, WM_SIZE, SENT },
204 { 1, WM_SIZE, 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
216{
217 { 1, WM_GETMINMAXINFO, SENT },
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 },
227 { 1, WM_NCCALCSIZE, SENT, TRUE },
228 { 1, WM_NCCALCSIZE, SENT_RET },
230 { 1, WM_MOVE, SENT },
231 { 1, WM_MOVE, SENT_RET },
232 { 1, WM_SIZE, SENT },
233 { 1, WM_SIZE, 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
247static BOOL
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
257static BOOL
259{
260 OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
261 DWORDLONG const dwlConditionMask = VerSetConditionMask(VerSetConditionMask(
265
268
270}
271
272static 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
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);
291 EMPTY_CACHE();
292
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);
303 EMPTY_CACHE();
304
305 g_ChangeStyle = 1;
306
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);
317 EMPTY_CACHE();
318
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);
329 EMPTY_CACHE();
330
331 UnregisterClassW(L"Test_Message_Window_XX", NULL);
332}
333
334
336{
337 LRESULT lRet;
338 int iwnd = get_iwnd(hWnd);
339
340 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
342
343 switch(message)
344 {
346 case WM_IME_NOTIFY:
347 case WM_GETICON:
348 case WM_GETTEXT:
350 break;
351 case WM_NCCREATE:
352 {
354 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
357
358 if (g_ChangeStyle)
359 {
361 dwStyle &= ~(WS_EX_CLIENTEDGE);
363 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
364 SetWindowPos(g_TestWindow, NULL, 0, 0, 0, 0,
366
367 RECORD_MESSAGE(iwnd, message, MARKER, 0, 0);
370 }
371 }
372 break;
373 case WM_CREATE:
374 {
376 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
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;
389 ok(wParam == 0,"expected wParam=0\n");
391 break;
392 default:
393 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
394 break;
395 }
397 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
398 return lRet;
399}
400
401
403{
404 LRESULT lRet;
405 int iwnd = get_iwnd(hWnd);
406
407 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
409
410 switch(message)
411 {
413 case WM_IME_NOTIFY:
414 case WM_GETICON:
415 case WM_GETTEXT:
417 break;
418 case WM_NCCREATE:
419 {
420 HWND child;
422 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
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);
434 break;
435 case WM_CREATE:
436 {
438 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
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;
451 ok(wParam == 0,"expected wParam=0\n");
453 break;
454 default:
455 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
456 break;
457 }
459 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
460 return lRet;
461}
462
463
465{
466 { 1, WM_GETMINMAXINFO, SENT },
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 },
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
491{
492 { 1, WM_GETMINMAXINFO, SENT },
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 },
503 { 1, WM_NCCALCSIZE, SENT, TRUE },
504 { 1, WM_NCCALCSIZE, SENT_RET },
506 { 1, WM_MOVE, SENT },
507 { 1, WM_MOVE, SENT_RET },
508 { 1, WM_SIZE, SENT },
509 { 1, WM_SIZE, 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 },
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
533{
534 { 1, WM_GETMINMAXINFO, SENT },
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 },
545 { 1, WM_NCCALCSIZE, SENT, TRUE },
546 { 1, WM_NCCALCSIZE, SENT_RET },
548 { 1, WM_MOVE, SENT },
549 { 1, WM_MOVE, SENT_RET },
550 { 1, WM_SIZE, SENT },
551 { 1, WM_SIZE, 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 },
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
578static 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
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);
600 EMPTY_CACHE();
601
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);
614 EMPTY_CACHE();
615
616 g_ChangeStyle = 1;
617
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);
630 EMPTY_CACHE();
631
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);
644 EMPTY_CACHE();
645
646 UnregisterClassW(L"Test_Message_Window_X2", NULL);
647 UnregisterClassW(L"Test_Message_Window_Child2", NULL);
648}
649
650
651
653{
654 LRESULT lRet;
655 int iwnd = get_iwnd(hWnd);
656
657 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
659
660 switch(message)
661 {
663 case WM_IME_NOTIFY:
664 case WM_GETICON:
665 case WM_GETTEXT:
667 break;
668 case WM_NCCREATE:
669 {
671 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
673 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
674 }
675 break;
676 case WM_CREATE:
677 {
678 CLIENTCREATESTRUCT ccs = { 0 };
680 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
682 ok_hex_(create->dwExStyle, g_ExpectExStyle);
683
684 g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL,
686 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs);
687
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;
700 ok(wParam == 0,"expected wParam=0\n");
702 break;
703 default:
704 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
705 break;
706 }
708 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
709 return lRet;
710}
711
713{
714 { 1, WM_GETMINMAXINFO, SENT },
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 },
723 { 1, WM_CREATE, SENT_RET },
724 { 0, 0 }
725};
726
727static void Test_Messages_MDI(void)
728{
729 HWND hWnd;
730
731 RegisterSimpleClass(MSGTestProcMDI, L"Test_Message_Window_MDI_XX");
732
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);
743 EMPTY_CACHE();
744
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);
755 EMPTY_CACHE();
756
757 UnregisterClassW(L"Test_Message_Window_MDI_XX", NULL);
758}
759
760
762{
763 LRESULT lRet;
764 int iwnd = get_iwnd(hWnd);
765
766 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
768
769 switch(message)
770 {
772 case WM_IME_NOTIFY:
773 case WM_GETICON:
774 case WM_GETTEXT:
776 break;
777 case WM_NCCREATE:
778 {
780 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
782 ok_hex_(create->dwExStyle, g_NcExpectExStyle);
783 }
784 break;
785 case WM_CREATE:
786 {
787 MDICREATESTRUCT mcs = {0};
788 CLIENTCREATESTRUCT ccs = { 0 };
790 HWND hchild;
791 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
793 ok_hex_(create->dwExStyle, g_ExpectExStyle);
794
795
796 g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL,
798 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs);
799
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
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;
822 ok(wParam == 0,"expected wParam=0\n");
824 break;
825 default:
826 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
827 break;
828 }
830 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
831 return lRet;
832}
833
835{
836 LRESULT lRet;
837 int iwnd = get_iwnd(hWnd);
838
839 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
841
842 switch(message)
843 {
845 case WM_IME_NOTIFY:
846 case WM_GETICON:
847 case WM_GETTEXT:
849 break;
850 case WM_NCCREATE:
851 {
853 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
856 }
857 break;
858 case WM_CREATE:
859 {
861 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
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;
874 ok(wParam == 0,"expected wParam=0\n");
876 break;
877 default:
878 RECORD_MESSAGE(iwnd, message, SENT, 0, 0);
879 break;
880 }
882 RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0);
883 return lRet;
884}
885
886
888{
889 { 1, WM_GETMINMAXINFO, SENT },
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 },
898 { 2, WM_GETMINMAXINFO, SENT },
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 },
913 { 2, WM_GETMINMAXINFO, SENT },
916 { 2, WM_NCCALCSIZE, SENT, 1 },
917 { 2, WM_NCCALCSIZE, SENT_RET },
919 { 2, WM_MOVE, SENT },
920 { 2, WM_MOVE, SENT_RET },
921 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
924 { 1, WM_NCCALCSIZE, SENT, TRUE },
925 { 1, WM_NCCALCSIZE, SENT_RET },
928 { 2, WM_SIZE, 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 },
936 { 2, WM_CHILDACTIVATE, SENT },
939 { 2, WM_MDIACTIVATE, SENT },
940 { 2, WM_MDIACTIVATE, SENT_RET },
944 { 1, WM_NCCALCSIZE, SENT, TRUE },
945 { 1, WM_NCCALCSIZE, SENT_RET },
948 { 1, WM_CREATE, SENT_RET },
949 { 0, 0 },
950};
951
953{
954 { 1, WM_GETMINMAXINFO, SENT },
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 },
963 { 2, WM_GETMINMAXINFO, SENT },
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 },
978 { 2, WM_GETMINMAXINFO, SENT },
981 { 2, WM_NCCALCSIZE, SENT, 1 },
982 { 2, WM_NCCALCSIZE, SENT_RET },
984 { 2, WM_MOVE, SENT },
985 { 2, WM_MOVE, SENT_RET },
986 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
989 { 1, WM_NCCALCSIZE, SENT, TRUE },
990 { 1, WM_NCCALCSIZE, SENT_RET },
993 { 2, WM_SIZE, 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 },
1001 { 2, WM_CHILDACTIVATE, SENT },
1004 { 2, WM_MDIACTIVATE, SENT },
1005 { 2, WM_MDIACTIVATE, SENT_RET },
1006 { 2, WM_CHILDACTIVATE, SENT_RET },
1009 { 1, WM_NCCALCSIZE, SENT, TRUE },
1010 { 1, WM_NCCALCSIZE, SENT_RET },
1013 { 1, WM_CREATE, SENT_RET },
1014 { 0, 0 },
1015};
1016
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 },
1043 { 2, WM_GETMINMAXINFO, SENT },
1044 { 2, WM_GETMINMAXINFO, SENT_RET },
1046 { 2, WM_NCCALCSIZE, SENT, 1 },
1047 { 2, WM_NCCALCSIZE, SENT_RET },
1049 { 2, WM_MOVE, SENT },
1050 { 2, WM_MOVE, SENT_RET },
1051 { 2, WM_SIZE, SENT, SIZE_MAXIMIZED },
1054 { 1, WM_NCCALCSIZE, SENT, TRUE },
1055 { 1, WM_NCCALCSIZE, SENT_RET },
1058 // +
1059 { 1, WM_NCCALCSIZE, SENT, TRUE },
1060 { 1, WM_NCCALCSIZE, SENT_RET },
1061 // -
1062 { 2, WM_SIZE, 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 },
1070 { 2, WM_CHILDACTIVATE, SENT },
1073 { 2, WM_MDIACTIVATE, SENT },
1074 { 2, WM_MDIACTIVATE, SENT_RET },
1075 { 2, WM_CHILDACTIVATE, SENT_RET },
1078 { 1, WM_NCCALCSIZE, SENT, TRUE },
1079 { 1, WM_NCCALCSIZE, SENT_RET },
1082 { 1, WM_CREATE, SENT_RET },
1083 { 0, 0 },
1084};
1085
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
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);
1108 EMPTY_CACHE();
1109
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);
1122 EMPTY_CACHE();
1123
1124 UnregisterClassW(L"Test_Message_Window_X2", NULL);
1125 UnregisterClassW(L"Test_Message_MDI_Window_Child2", NULL);
1126}
1127
1128
1130{
1131 Test_Params();
1132 Test_Messages();
1136}
static DWORD g_ChildExpectStyle
static HWND g_ChildWindow
static BOOL IsWindowsServer()
static DWORD g_FaultLine
static LRESULT CALLBACK MSGTestProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK MSGTestProcMDI(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static DWORD g_ChildNcExpectStyle
static DWORD g_NcExpectExStyle
static DWORD g_ExpectStyle
static DWORD g_ChildExpectExStyle
static MSG_ENTRY create_chain_modify_below8_nonsrv[]
static LRESULT CALLBACK MSGChildProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MSG_ENTRY child_create_chain[]
MSG_ENTRY child_create_chain_modify_below8_nonsrv[]
static int g_ChangeStyle
static int get_iwnd(HWND hWnd)
#define ok_hex_(expression, result)
static BOOL IsWindows8OrGreater()
static LRESULT CALLBACK MSGTestProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
MSG_ENTRY child_create_chain_modify[]
static void Test_Messages(void)
static LRESULT CALLBACK MSGChildProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static void Test_Messages_MDI_Child(void)
MSG_ENTRY create_chain_MDI[]
static HWND g_hwndMDIClient
static LRESULT CALLBACK MSGTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static MSG_ENTRY child_create_chain_MDI_below8[]
static MSG_ENTRY child_create_chain_MDI[]
static void Test_Messages_Child(void)
static DWORD g_NcExpectStyle
static HWND g_TestWindow
static DWORD g_ChildNcExpectExStyle
static void Test_Messages_MDI(void)
static void Test_Params(void)
static MSG_ENTRY create_chain_modify[]
static MSG_ENTRY create_chain[]
static DWORD g_ExpectExStyle
static MSG_ENTRY child_create_chain_MDI_below8_nonsrv[]
static struct myctx * mcs
Definition: adnstest.c:53
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI VerifyVersionInfoW(IN LPOSVERSIONINFOEXW lpVersionInformation, IN DWORD dwTypeMask, IN DWORDLONG dwlConditionMask)
Definition: version.c:118
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
unsigned long long DWORDLONG
Definition: intsafe.h:93
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
static const struct access_res create[16]
Definition: package.c:7644
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static HWND child
Definition: cursoricon.c:298
#define EMPTY_CACHE()
Definition: msgtrace.h:59
static BOOL IsDWmMsg(UINT msg)
Definition: msgtrace.h:39
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
@ MARKER
Definition: msgtrace.h:11
@ SENT_RET
Definition: msgtrace.h:10
@ SENT
Definition: msgtrace.h:6
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define VER_EQUAL
Definition: rtltypes.h:239
#define VER_MAJORVERSION
Definition: rtltypes.h:229
#define VER_PRODUCT_TYPE
Definition: rtltypes.h:235
#define VER_GREATER_EQUAL
Definition: rtltypes.h:241
#define VER_MINORVERSION
Definition: rtltypes.h:228
#define VER_SERVICEPACKMAJOR
Definition: rtltypes.h:233
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define DefWindowProc
Definition: ros2win.h:31
#define DefMDIChildProc
Definition: ros2win.h:33
ULONGLONG NTAPI VerSetConditionMask(IN ULONGLONG ConditionMask, IN ULONG TypeMask, IN UCHAR Condition)
Definition: version.c:262
#define _WIN32_WINNT_WIN8
Definition: sdkddkver.h:29
Definition: msgtrace.h:15
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwMinorVersion
Definition: rtltypes.h:239
Definition: tftpd.h:60
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
OSVERSIONINFO osvi
Definition: ver.c:28
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_TLW_WITH_WSCHILD
Definition: winerror.h:887
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define CreateWindowEx
Definition: winuser.h:5755
#define SetWindowLong
Definition: winuser.h:5853
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define SWP_NOREDRAW
Definition: winuser.h:1246
CREATESTRUCTA * LPCREATESTRUCT
Definition: winuser.h:5726
#define SWP_FRAMECHANGED
Definition: winuser.h:1240
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_MDICREATE
Definition: winuser.h:1812
#define WM_IME_NOTIFY
Definition: winuser.h:1830
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_CHILDACTIVATE
Definition: winuser.h:1638
#define WM_CREATE
Definition: winuser.h:1608
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_DRAWFRAME
Definition: winuser.h:1239
#define WM_SIZE
Definition: winuser.h:1611
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_MDIACTIVATE
Definition: winuser.h:1814
#define WM_NCCREATE
Definition: winuser.h:1683
#define CreateWindow
Definition: winuser.h:5754
#define WM_SHOWWINDOW
Definition: winuser.h:1628
#define WM_IME_SETCONTEXT
Definition: winuser.h:1829
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_GETMINMAXINFO
Definition: winuser.h:1640
#define SIZE_MAXIMIZED
Definition: winuser.h:2507
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
#define SendMessage
Definition: winuser.h:5843
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define GetWindowLong
Definition: winuser.h:5796
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_MOVE
Definition: winuser.h:1610
#define WM_NCDESTROY
Definition: winuser.h:1684
#define WM_USER
Definition: winuser.h:1895
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_PARENTNOTIFY
Definition: winuser.h:1803
#define WS_EX_OVERLAPPEDWINDOW
Definition: winuser.h:398
#define SWP_NOZORDER
Definition: winuser.h:1247
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
BOOL WINAPI DestroyWindow(_In_ HWND)
#define GWL_EXSTYLE
Definition: winuser.h:851
#define VER_NT_WORKSTATION
char * LPSTR
Definition: xmlstorage.h:182
const CHAR * LPCTSTR
Definition: xmlstorage.h:193