1 My tests show that Windows window management events behave like described
2 in this file, at least under Win98.
3 The (16/32) or (16) or (32) at the end shows whether the sequence has been
4 confirmed for win16, win32, or both.
6 Window Edge Styles (Win95/98 look):
7 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
8 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
9 WS_THICKFRAME: thick border
10 WS_BORDER (default for top-level windows): single black border
11 none (default for child windows): no border
13 CreateWindow (for overlapped window, not initially visible) (16/32)
17 WM_NCCALCSIZE (wParam=0)
20 ShowWindow (for overlapped window) (16/32)
22 WM_SHOWWINDOW (wParam=1)
23 WM_WINDOWPOSCHANGING (NOMOVE|NOSIZE|SHOWWINDOW)
24 WM_QUERYNEWPALETTE, if in 256-color mode
25 WM_WINDOWPOSCHANGING (NOMOVE|NOSIZE)
26 WM_ACTIVATEAPP (wParam=1)
27 WM_NCACTIVATE (wParam=1)
30 WM_ACTIVATE (wParam=1)
32 WM_SETFOCUS (wParam=0)
37 WM_WINDOWPOSCHANGED (NOMOVE|NOSIZE|NOZORDER|SHOWWINDOW)
38 WM_SIZE (NOT from DefWindowProc)
39 WM_MOVE (NOT from DefWindowProc)
41 (WM_NCHITTEST and WM_SETCURSOR will tend to follow immediately after the
42 ShowWindow if the mouse is inside the window)
44 DestroyWindow (for overlapped window) (32)
46 WM_WINDOWPOSCHANGING (wParam=0)
47 WM_WINDOWPOSCHANGED (wParam=0)
48 WM_NCACTIVATE (wParam=0)
49 WM_ACTIVATE (wParam=0)
50 WM_ACTIVATEAPP (wParam=0)
51 WM_KILLFOCUS (wParam=0)
55 CreateWindow (for child window, not initially visible)
57 WM_NCCREATE (Note that win->parent->child will not contain win. link is done after sucessfull WM_NCCREATE)
58 WM_NCCALCSIZE (wParam=0)
62 (to parent window) WM_PARENTNOTIFY (wParam=1)
64 ShowWindow (for child window)
66 WM_SHOWWINDOW (wParam=1)
67 WM_WINDOWPOSCHANGING (wParam=0)
68 (to parent window) WM_ERASEBKGND
69 WM_WINDOWPOSCHANGED (wParam=0)
71 DestroyWindow (for child window)
73 (to parent window) WM_PARENTNOTIFY (wParam=2)
74 WM_SHOWWINDOW (wParam=0)
75 WM_WINDOWPOSCHANGING (wParam=0)
76 (to parent window) WM_ERASEBKGND
77 WM_WINDOWPOSCHANGED (wParam=0)
86 WM_MOUSEMOVE, if WM_NCHITTEST returns HTCLIENT
87 WM_NCMOUSEMOVE, if WM_NCHITTEST returns somewhere in nonclient area (not HTNOWHERE)
89 Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move):
90 WM_NCLBUTTONDOWN (wParam=2=HTCAPTION)
92 WM_SYSCOMMAND (wParam=0xf012=SC_MOVE+2)
102 Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move):
103 WM_NCLBUTTONDOWN (wParam=0xd)
105 WM_SYSCOMMAND (wParam=0xf004)
109 WM_SIZING (wParam=4) (many times, probably one for each mouse movement)
113 WM_NCCALCSIZE (wParam=1)
114 WM_NCPAINT (wParam=1)
124 Resizing child window with MoveWindow (32):
126 WM_NCCALCSIZE (wParam=1)
133 Clicking on inactive button:
136 (to parent window) WM_PARENTNOTIFY (wParam=0x201=WM_LBUTTONDOWN)
138 ButtonProc->DefWindowProc:
139 (to parent window) WM_MOUSEACTIVATE
141 ButtonProc->DefWindowProc:
142 (to parent window) WM_SETCURSOR
145 (to parent window) WM_KILLFOCUS
147 (to parent window) WM_CTLCOLORBTN
149 (to parent window) WM_CTLCOLORBTN
152 (to parent window) WM_CTLCOLORBTN
153 (to parent window) WM_COMMAND
155 Reparenting a button (16/32):
156 WM_SHOWWINDOW (wParam=0)
157 WM_WINDOWPOSCHANGING (HIDEWINDOW|NOACTIVATE|NOMOVE|NOSIZE|NOZORDER)
158 (to parent window) WM_ERASEBKGND
159 WM_WINDOWPOSCHANGED (HIDEWINDOW|NOACTIVATE|NOMOVE|NOSIZE|NOZORDER)
160 WM_WINDOWPOSCHANGING (NOSIZE|NOZORDER)
162 WM_WINDOWPOSCHANGED (NOSIZE|NOREDRAW|NOZORDER)
165 WM_SHOWWINDOW (wParam=1)
166 The last child (button) reparented gets topmost for its new parent.
168 Creation of a modal dialog (32):
169 (to parent window) WM_CANCELMODE
170 (to parent window) WM_KILLFOCUS
171 (to parent window) WM_ENABLE (wParam=0)
172 (window proc creation messages not tracked yet, because...)
174 (dlgproc) WM_INITDIALOG
175 (...the window proc message hook was installed here, IsVisible still FALSE)
176 (to parent window) WM_NCACTIVATE (wParam=0)
179 (to parent window) WM_ACTIVATE (wParam=0)
181 (to parent window) WM_WINDOWPOSCHANGING
182 WM_NCACTIVATE (wParam=1)
183 WM_ACTIVATE (wParam=1)
185 WM_SHOWWINDOW (wParam=1)
195 (bunch of WM_CTLCOLOR* for each control)
196 (to parent window) WM_PAINT
197 (to parent window) WM_ENTERIDLE (wParam=0)
198 (to parent window) WM_SETCURSOR
200 Destruction of a modal dialog (32):
201 (inside dialog proc: EndDialog is called)
202 (to parent window) WM_ENABLE (wParam=1)
205 (to parent window) WM_NCPAINT
208 (to parent window) WM_ERASEBKGND
210 WM_NCACTIVATE (wParam=0)
211 WM_ACTIVATE (wParam=0)
213 (to parent window) WM_WINDOWPOSCHANGING
214 (to parent window) WM_NCACTIVATE (wParam=1)
217 (to parent window) WM_ACTIVATE (wParam=1)
218 (to dialog) WM_KILLFOCUS
219 (to parent window) WM_SETFOCUS
223 Creation of a modal dialog that is resized inside WM_INITDIALOG (32):
224 (inside dialog proc, handling WM_INITDIALOG)
227 (to parent window) WM_NCACTIVATE (wParam=0)
230 (to parent window) WM_ACTIVATE (wParam=0)
232 (to parent window) WM_WINDOWPOSCHANGING
233 WM_NCACTIVATE (wParam=1)
234 WM_ACTIVATE (wParam=1)
239 WM_SHOWWINDOW (wParam=1)
249 (bunch of WM_CTLCOLOR* for each control)
250 (to parent window) WM_PAINT
251 (to parent window) WM_ENTERIDLE (wParam=0)
252 (to parent window) WM_SETCURSOR