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 (Win31 look), in order of precedence:
7 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
8 WS_THICKFRAME: thick border
9 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway, untested)
10 WS_BORDER (default for overlapped windows): single black border
11 none (default for child and popup windows): no border
13 Window Edge Styles (Win95/98 look), in order of precedence:
14 WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed
15 WS_THICKFRAME: thick border
16 WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway)
17 WS_BORDER (default for overlapped windows): single black border
18 none (default for child (and popup?) windows): no border
20 Win31 look, system metrics relations:
21 CYFRAME = 5, thick border, includes both edges (the colored inside is thus 3 pixels)
22 CYDLGFRAME = 4, double border
23 CYBORDER = 1, thin border
24 CYCAPTION = 20, includes both borders (the colored inside is thus 18 pixels)
25 CYMENU = 18, does not include any borders
26 CYHSCROLL = 17, includes both borders (the colored inside is thus 15 pixels)
28 CreateWindow (for overlapped window, not initially visible) (16/32)
32 WM_NCCALCSIZE (wParam=0)
35 ShowWindow (for overlapped window) (16/32)
37 WM_SHOWWINDOW (wParam=1)
38 WM_WINDOWPOSCHANGING (NOMOVE|NOSIZE|SHOWWINDOW)
39 WM_QUERYNEWPALETTE, if in 256-color mode
40 WM_WINDOWPOSCHANGING (NOMOVE|NOSIZE)
41 WM_ACTIVATEAPP (wParam=1)
42 WM_NCACTIVATE (wParam=1)
45 WM_ACTIVATE (wParam=1)
47 WM_SETFOCUS (wParam=0)
52 WM_WINDOWPOSCHANGED (NOMOVE|NOSIZE|NOZORDER|SHOWWINDOW)
53 WM_SIZE (NOT from DefWindowProc)
54 WM_MOVE (NOT from DefWindowProc)
56 (WM_NCHITTEST and WM_SETCURSOR will tend to follow immediately after the
57 ShowWindow if the mouse is inside the window)
59 DestroyWindow (for overlapped window) (32)
61 WM_WINDOWPOSCHANGING (wParam=0)
62 WM_WINDOWPOSCHANGED (wParam=0)
63 WM_NCACTIVATE (wParam=0)
64 WM_ACTIVATE (wParam=0)
65 WM_ACTIVATEAPP (wParam=0)
66 WM_KILLFOCUS (wParam=0)
70 CreateWindow (for child window, not initially visible)
73 (child is inserted into parent's child list after WM_NCCREATE returns)
74 WM_NCCALCSIZE (wParam=0)
78 (to parent window) WM_PARENTNOTIFY (wParam=1)
80 ShowWindow (for child window)
82 WM_SHOWWINDOW (wParam=1)
83 WM_WINDOWPOSCHANGING (wParam=0)
84 (to parent window) WM_ERASEBKGND
85 WM_WINDOWPOSCHANGED (wParam=0)
87 DestroyWindow (for child window)
89 (to parent window) WM_PARENTNOTIFY (wParam=2)
90 WM_SHOWWINDOW (wParam=0)
91 WM_WINDOWPOSCHANGING (wParam=0)
92 (to parent window) WM_ERASEBKGND
93 WM_WINDOWPOSCHANGED (wParam=0)
102 WM_MOUSEMOVE, if WM_NCHITTEST returns HTCLIENT
103 WM_NCMOUSEMOVE, if WM_NCHITTEST returns somewhere in nonclient area (not HTNOWHERE)
105 Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move):
106 WM_NCLBUTTONDOWN (wParam=2=HTCAPTION)
108 WM_SYSCOMMAND (wParam=0xf012=SC_MOVE+2)
118 Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move):
119 WM_NCLBUTTONDOWN (wParam=0xd)
121 WM_SYSCOMMAND (wParam=0xf004)
125 WM_SIZING (wParam=4) (many times, probably one for each mouse movement)
129 WM_NCCALCSIZE (wParam=1)
130 WM_NCPAINT (wParam=1)
140 Resizing child window with MoveWindow (32):
142 WM_NCCALCSIZE (wParam=1)
149 Clicking on inactive button:
152 (to parent window) WM_PARENTNOTIFY (wParam=0x201=WM_LBUTTONDOWN)
154 ButtonProc->DefWindowProc:
155 (to parent window) WM_MOUSEACTIVATE
157 ButtonProc->DefWindowProc:
158 (to parent window) WM_SETCURSOR
161 (to parent window) WM_KILLFOCUS
163 (to parent window) WM_CTLCOLORBTN
165 (to parent window) WM_CTLCOLORBTN
168 (to parent window) WM_CTLCOLORBTN
169 (to parent window) WM_COMMAND
171 Reparenting a button (16/32):
172 WM_SHOWWINDOW (wParam=0)
173 WM_WINDOWPOSCHANGING (HIDEWINDOW|NOACTIVATE|NOMOVE|NOSIZE|NOZORDER)
174 (to parent window) WM_ERASEBKGND
175 WM_WINDOWPOSCHANGED (HIDEWINDOW|NOACTIVATE|NOMOVE|NOSIZE|NOZORDER)
176 WM_WINDOWPOSCHANGING (NOSIZE|NOZORDER)
178 WM_WINDOWPOSCHANGED (NOSIZE|NOREDRAW|NOZORDER)
181 WM_SHOWWINDOW (wParam=1)
182 The last child (button) reparented gets topmost for its new parent.
184 Creation of a modal dialog (32):
185 (to parent window) WM_CANCELMODE
186 (to parent window) WM_KILLFOCUS
187 (to parent window) WM_ENABLE (wParam=0)
188 (window proc creation messages not tracked yet, because...)
190 (dlgproc) WM_INITDIALOG
191 (...the window proc message hook was installed here, IsVisible still FALSE)
192 (to parent window) WM_NCACTIVATE (wParam=0)
195 (to parent window) WM_ACTIVATE (wParam=0)
197 (to parent window) WM_WINDOWPOSCHANGING
198 WM_NCACTIVATE (wParam=1)
199 WM_ACTIVATE (wParam=1)
201 WM_SHOWWINDOW (wParam=1)
211 (bunch of WM_CTLCOLOR* for each control)
212 (to parent window) WM_PAINT
213 (to parent window) WM_ENTERIDLE (wParam=0)
214 (to parent window) WM_SETCURSOR
216 Destruction of a modal dialog (32):
217 (inside dialog proc: EndDialog is called)
218 (to parent window) WM_ENABLE (wParam=1)
221 (to parent window) WM_NCPAINT
224 (to parent window) WM_ERASEBKGND
226 WM_NCACTIVATE (wParam=0)
227 WM_ACTIVATE (wParam=0)
229 (to parent window) WM_WINDOWPOSCHANGING
230 (to parent window) WM_NCACTIVATE (wParam=1)
233 (to parent window) WM_ACTIVATE (wParam=1)
234 (to dialog) WM_KILLFOCUS
235 (to parent window) WM_SETFOCUS
239 Creation of a modal dialog that is resized inside WM_INITDIALOG (32):
240 (inside dialog proc, handling WM_INITDIALOG)
243 (to parent window) WM_NCACTIVATE (wParam=0)
246 (to parent window) WM_ACTIVATE (wParam=0)
248 (to parent window) WM_WINDOWPOSCHANGING
249 WM_NCACTIVATE (wParam=1)
250 WM_ACTIVATE (wParam=1)
255 WM_SHOWWINDOW (wParam=1)
265 (bunch of WM_CTLCOLOR* for each control)
266 (to parent window) WM_PAINT
267 (to parent window) WM_ENTERIDLE (wParam=0)
268 (to parent window) WM_SETCURSOR