beb4a532cbc9ace74fa67c983e4dd89b97a41722
[reactos.git] / sdk / include / reactos / winxx.h
1 /*
2 * PROJECT: ReactOS header files
3 * LICENSE: CC-BY-4.0 (https://spdx.org/licenses/CC-BY-4.0.html)
4 * PURPOSE: An unofficial extension of <windowsx.h>
5 * COPYRIGHT: Copyright 2017-2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8 #ifndef _INC_WINXX
9 #define _INC_WINXX 2 /* Version 2 */
10
11 #pragma once
12
13 #ifndef _INC_WINDOWS
14 #include <windows.h>
15 #endif
16 #ifndef _INC_WINDOWSX
17 #include <windowsx.h>
18 #endif
19 #ifndef _INC_COMMCTRL
20 #include <commctrl.h>
21 #endif
22
23 /* additional message crackers */
24
25 /* void Cls_OnNull(HWND hwnd) */
26 #ifndef HANDLE_WM_NULL
27 #define HANDLE_WM_NULL(hwnd, wParam, lParam, fn) \
28 ((fn)((hwnd)), 0L)
29 #define FORWARD_WM_NULL(hwnd, fn) \
30 (void)((fn)((hwnd), WM_NULL, 0, 0L), 0L)
31 #endif
32
33 /* INT Cls_OnSetHotKey(HWND hwnd, INT nCode, UINT nOptions) */
34 #ifndef HANDLE_WM_SETHOTKEY
35 #define HANDLE_WM_SETHOTKEY(hwnd, wParam, lParam, fn) \
36 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)LOWORD(wParam), (UINT)HIWORD(wParam))
37 #define FORWARD_WM_SETHOTKEY(hwnd, nCode, nOptions, fn) \
38 (INT)(fn)((hwnd), WM_SETHOTKEY, MAKEWPARAM((nCode), (nOptions)))
39 #endif
40
41 /* INT Cls_OnGetHotKey(HWND hwnd) */
42 #ifndef HANDLE_WM_GETHOTKEY
43 #define HANDLE_WM_GETHOTKEY(hwnd, wParam, lParam, fn) \
44 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
45 #define FORWARD_WM_GETHOTKEY(hwnd, fn) \
46 (INT)(fn)((hwnd), WM_GETHOTKEY, 0, 0L)
47 #endif
48
49 /* void Cls_OnPaintIcon(HWND hwnd) */
50 #ifndef HANDLE_WM_PAINTICON
51 #define HANDLE_WM_PAINTICON(hwnd, wParam, lParam, fn) \
52 ((fn)((hwnd)), 0L)
53 #define FORWARD_WM_PAINTICON(hwnd, fn) \
54 (void)((fn)((hwnd), WM_PAINTICON, 0, 0L), 0L)
55 #endif
56
57 /* LRESULT Cls_OnGetObject(HWND hwnd, WPARAM wParam, DWORD dwObjId) */
58 #ifndef HANDLE_WM_GETOBJECT
59 #define HANDLE_WM_GETOBJECT(hwnd, wParam, lParam, fn) \
60 (LRESULT)(fn)((hwnd), (WPARAM)(wParam), (DWORD)(lParam))
61 #define FORWARD_WM_GETOBJECT(hwnd, wParam, dwObjId, fn) \
62 (fn)((hwnd), WM_GETOBJECT, (WPARAM)(wParam), (LPARAM)(DWORD)(dwObjId))
63 #endif
64
65 /* void Cls_OnCancelJournal(HWND hwnd) */
66 #ifndef HANDLE_WM_CANCELJOURNAL
67 #define HANDLE_WM_CANCELJOURNAL(hwnd, wParam, lParam, fn) \
68 ((fn)((hwnd)), 0L)
69 #define FORWARD_WM_CANCELJOURNAL(hwnd, fn) \
70 (void)((fn)((hwnd), WM_PAINTICON, 0, 0L), 0L)
71 #endif
72
73 /* void Cls_OnInputLangChangeRequest(HWND hwnd, BOOL bFlag, HKL hKL) */
74 #ifndef HANDLE_WM_INPUTLANGCHANGEREQUEST
75 #define HANDLE_WM_INPUTLANGCHANGEREQUEST(hwnd, wParam, lParam, fn) \
76 ((fn)((hwnd), (BOOL)(wParam), (HKL)(lParam)), 0L)
77 #define FORWARD_WM_INPUTLANGCHANGEREQUEST(hwnd, bFlag, hKL, fn) \
78 (void)((fn)((hwnd), WM_INPUTLANGCHANGEREQUEST, (WPARAM)(BOOL)(bFlag), \
79 (LPARAM)(HKL)(hKL)), 0L)
80 #endif
81
82 /* void Cls_OnInputLangChange(HWND hwnd, DWORD dwCharSet, HKL hKL) */
83 #ifndef HANDLE_WM_INPUTLANGCHANGE
84 #define HANDLE_WM_INPUTLANGCHANGE(hwnd, wParam, lParam, fn) \
85 ((fn)((hwnd), (DWORD)(wParam), (HKL)(lParam)), 0L)
86 #define FORWARD_WM_INPUTLANGCHANGE(hwnd, dwCharSet, hKL, fn) \
87 (void)((fn)((hwnd), WM_INPUTLANGCHANGE, (WPARAM)(DWORD)(dwCharSet), \
88 (LPARAM)(HKL)(hKL)), 0L)
89 #endif
90
91 /* void Cls_OnTCard(HWND hwnd, UINT idAction, DWORD dwActionData) */
92 #ifndef HANDLE_WM_TCARD
93 #define HANDLE_WM_TCARD(hwnd, wParam, lParam, fn) \
94 ((fn)((hwnd), (UINT)(wParam), (DWORD)(lParam)), 0L)
95 #define FORWARD_WM_TCARD(hwnd, idAction, dwActionData, fn) \
96 (void)((fn)((hwnd), WM_TCARD, (DWORD)(wParam), (DWORD)(lParam)), 0L)
97 #endif
98
99 /* void Cls_OnHelp(HWND hwnd, LPHELPINFO lpHelpInfo) */
100 #ifndef HANDLE_WM_HELP
101 #define HANDLE_WM_HELP(hwnd, wParam, lParam, fn) \
102 ((fn)((hwnd), (LPHELPINFO)(lParam)), 0L)
103 #define FORWARD_WM_HELP(hwnd, lpHelpInfo, fn) \
104 (void)((fn)((hwnd), WM_HELP, 0, (LPARAM)(LPHELPINFO)(lpHelpInfo)), 0L)
105 #endif
106
107 /* void Cls_OnUserChanged(HWND hwnd) */
108 #ifndef HANDLE_WM_USERCHANGED
109 #define HANDLE_WM_USERCHANGED(hwnd, wParam, lParam, fn) \
110 ((fn)((hwnd)), 0L)
111 #define FORWARD_WM_USERCHANGED(hwnd, fn) \
112 (void)((fn)((hwnd), WM_USERCHANGED, 0, 0L), 0L)
113 #endif
114
115 /* INT Cls_OnNotifyFormat(HWND hwnd, HWND hwndTarget, INT nCommand) */
116 #ifndef HANDLE_WM_NOTIFYFORMAT
117 #define HANDLE_WM_NOTIFYFORMAT(hwnd, wParam, lParam, fn) \
118 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (HWND)(wParam), (INT)(lParam))
119 #define FORWARD_WM_NOTIFYFORMAT(hwnd, hwndTarget, nCommand, fn) \
120 (INT)(fn)((hwnd), WM_NOTIFYFORMAT, (WPARAM)(HWND)(hwndTarget), \
121 (LPARAM)(INT)(nCommand))
122 #endif
123
124 /* void Cls_OnStyleChanging(HWND hwnd, UINT nStyleType, LPSTYLESTRUCT lpStyleStruct) */
125 #ifndef HANDLE_WM_STYLECHANGING
126 #define HANDLE_WM_STYLECHANGING(hwnd, wParam, lParam, fn) \
127 ((fn)((hwnd), (UINT)(wParam), (LPSTYLESTRUCT)(lParam)), 0L)
128 #define FORWARD_WM_STYLECHANGING(hwnd, nStyleType, lpStyleStruct, fn) \
129 (void)((fn)((hwnd), WM_STYLECHANGING, (WPARAM)(UINT)(nStyleType), \
130 (LPARAM)(LPSTYLESTRUCT)(lpStyleStruct)), 0L)
131 #endif
132
133 /* void Cls_OnStyleChanged(HWND hwnd, UINT nStyleType, const STYLESTRUCT *lpStyleStruct) */
134 #ifndef HANDLE_WM_STYLECHANGED
135 #define HANDLE_WM_STYLECHANGED(hwnd, wParam, lParam, fn) \
136 ((fn)((hwnd), (UINT)(wParam), (const STYLESTRUCT *)(lParam)), 0L)
137 #define FORWARD_WM_STYLECHANGED(hwnd, nStyleType, lpStyleStruct, fn) \
138 (void)((fn)((hwnd), WM_STYLECHANGED, (WPARAM)(UINT)(nStyleType), \
139 (LPARAM)(const STYLESTRUCT *)(lpStyleStruct)), 0L)
140 #endif
141
142 /* HICON Cls_OnGetIcon(HWND hwnd, UINT nType, LPARAM dpi) */
143 #ifndef HANDLE_WM_GETICON
144 #define HANDLE_WM_GETICON(hwnd, wParam, lParam, fn) \
145 (LRESULT)(HICON)(fn)((hwnd), (INT)(wParam), (LPARAM)(lParam))
146 #define FORWARD_WM_GETICON(hwnd, nType, dpi, fn) \
147 (HICON)(fn)((hwnd), WM_GETICON, (WPARAM)(UINT)(nType), (LPARAM)(dpi))
148 #endif
149
150 /* HICON Cls_OnSetIcon(HWND hwnd, UINT nType, HICON hIcon) */
151 #ifndef HANDLE_WM_SETICON
152 #define HANDLE_WM_SETICON(hwnd, wParam, lParam, fn) \
153 (LRESULT)(HICON)(fn)((hwnd), (INT)(wParam), (HICON)(lParam))
154 #define FORWARD_WM_SETICON(hwnd, nType, hIcon, fn) \
155 (HICON)(fn)((hwnd), WM_SETICON, (WPARAM)(UINT)(nType), (LPARAM)(HICON)(hIcon))
156 #endif
157
158 /* void Cls_OnSyncPaint(HWND hwnd) */
159 #ifndef HANDLE_WM_SYNCPAINT
160 #define HANDLE_WM_SYNCPAINT(hwnd, wParam, lParam, fn) \
161 ((fn)((hwnd)), 0L)
162 #define FORWARD_WM_SYNCPAINT(hwnd, fn) \
163 (void)((fn)((hwnd), WM_SYNCPAINT, 0, 0L), 0L)
164 #endif
165
166 /* void Cls_OnNCXButtonDown(HWND hwnd, BOOL fDoubleClick, UINT nHitTest, WORD fwButton, INT xPos, INT yPos) */
167 #ifndef HANDLE_WM_NCXBUTTONDOWN
168 #define HANDLE_WM_NCXBUTTONDOWN(hwnd, wParam, lParam, fn) \
169 (LRESULT)((fn)((hwnd), FALSE, GET_NCHITTEST_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
170 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
171 #define HANDLE_WM_NCXBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
172 (LRESULT)((fn)((hwnd), TRUE, GET_NCHITTEST_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
173 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
174 #define FORWARD_WM_NCXBUTTONDOWN(hwnd, fDoubleClick, nHitTest, fwButton, xPos, yPos, fn) \
175 (void)((fn)((hwnd), ((fDoubleClick) ? WM_NCXBUTTONDBLCLK : WM_NCXBUTTONDOWN), \
176 MAKEWPARAM((nHitTest), (fwButton)), MAKELPARAM((xPos), (yPos))), 0L)
177 #endif
178
179 /* void Cls_OnNCXButtonUp(HWND hwnd, UINT nHitTest, WORD fwButton, INT xPos, INT yPos) */
180 #ifndef HANDLE_WM_NCXBUTTONUP
181 #define HANDLE_WM_NCXBUTTONUP(hwnd, wParam, lParam, fn) \
182 (LRESULT)((fn)((hwnd), GET_NCHITTEST_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
183 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
184 #define FORWARD_WM_NCXBUTTONUP(hwnd, nHitTest, fwButton, xPos, yPos, fn) \
185 (void)((fn)((hwnd), WM_NCXBUTTONUP, MAKEWPARAM((nHitTest), (fwButton)), \
186 MAKELPARAM((xPos), (yPos))), 0L)
187 #endif
188
189 /* void Cls_OnImeStartComposition(HWND hwnd) */
190 #ifndef HANDLE_WM_IME_STARTCOMPOSITION
191 #define HANDLE_WM_IME_STARTCOMPOSITION(hwnd, wParam, lParam, fn) \
192 ((fn)((hwnd)), 0L)
193 #define FORWARD_WM_IME_STARTCOMPOSITION(hwnd, fn) \
194 (void)((fn)((hwnd), WM_IME_STARTCOMPOSITION, 0, 0L), 0L)
195 #endif
196
197 /* void Cls_OnImeEndComposition(HWND hwnd) */
198 #ifndef HANDLE_WM_IME_ENDCOMPOSITION
199 #define HANDLE_WM_IME_ENDCOMPOSITION(hwnd, wParam, lParam, fn) \
200 ((fn)((hwnd)), 0L)
201 #define FORWARD_WM_IME_ENDCOMPOSITION(hwnd, fn) \
202 (void)((fn)((hwnd), WM_IME_ENDCOMPOSITION, 0, 0L), 0L)
203 #endif
204
205 /* void Cls_OnImeComposition(HWND hwnd, WORD wChar, DWORD lAttribute) */
206 #ifndef HANDLE_WM_IME_COMPOSITION
207 #define HANDLE_WM_IME_COMPOSITION(hwnd, wParam, lParam, fn) \
208 ((fn)((hwnd), (WORD)(wParam), (DWORD)(lParam)), 0L)
209 #define FORWARD_WM_IME_COMPOSITION(hwnd, wChar, lAttribute, fn) \
210 (void)((fn)((hwnd), WM_IME_COMPOSITION, (WPARAM)(WORD)(wChar), (DWORD)(lAttribute)), 0L)
211 #endif
212
213 /* void Cls_OnMenuRButtonUp(HWND hwnd, UINT nPos, HMENU hMenu) */
214 #ifndef HANDLE_WM_MENURBUTTONUP
215 #define HANDLE_WM_MENURBUTTONUP(hwnd, wParam, lParam, fn) \
216 ((fn)((hwnd), (UINT)(wParam), (HMENU)(lParam)), 0L)
217 #define FORWARD_WM_MENURBUTTONUP(hwnd, nPos, hMenu, fn) \
218 (void)((fn)((hwnd), WM_MENURBUTTONUP, (WPARAM)(UINT)(nPos), (LPARAM)(HMENU)(hMenu)), 0L)
219 #endif
220
221 /* UINT Cls_OnMenuDrag(HWND hwnd, UINT nPos, HMENU hMenu) */
222 #ifndef HANDLE_WM_MENUDRAG
223 #define HANDLE_WM_MENUDRAG(hwnd, wParam, lParam, fn) \
224 (LRESULT)(UINT)(fn)((hwnd), (UINT)(wParam), (HMENU)(lParam))
225 #define FORWARD_WM_MENUDRAG(hwnd, nPos, hMenu, fn) \
226 (UINT)(fn)((hwnd), WM_MENUDRAG, (WPARAM)(UINT)(nPos), (LPARAM)(HMENU)(hMenu))
227 #endif
228
229 /* UINT Cls_OnMenuGetObject(HWND hwnd, MENUGETOBJECTINFO *pmgoi) */
230 #ifndef HANDLE_WM_MENUGETOBJECT
231 #define HANDLE_WM_MENUGETOBJECT(hwnd, wParam, lParam, fn) \
232 (LRESULT)(UINT)(fn)((hwnd), (MENUGETOBJECTINFO *)(lParam))
233 #define FORWARD_WM_MENUGETOBJECT(hwnd, pmgoi, fn) \
234 (UINT)(fn)((hwnd), WM_MENUGETOBJECT, 0, (LPARAM)(MENUGETOBJECTINFO *)(pmgoi))
235 #endif
236
237 /* void Cls_OnUninitMenuPopup(HWND hwnd, HMENU hMenu, UINT nFlags) */
238 #ifndef HANDLE_WM_UNINITMENUPOPUP
239 #define HANDLE_WM_UNINITMENUPOPUP(hwnd, wParam, lParam, fn) \
240 ((fn)((hwnd), (HMENU)(wParam), (UINT)(lParam)), 0L)
241 #define FORWARD_WM_UNINITMENUPOPUP(hwnd, hMenu, nFlags, fn) \
242 (void)((fn)((hwnd), WM_UNINITMENUPOPUP, (WPARAM)(HMENU)(hMenu), \
243 (LPARAM)(UINT)(nFlags)), 0L)
244 #endif
245
246 /* void Cls_OnMenuCommand(HWND hwnd, UINT nPos, HMENU hMenu) */
247 #ifndef HANDLE_WM_MENUCOMMAND
248 #define HANDLE_WM_MENUCOMMAND(hwnd, wParam, lParam, fn) \
249 ((fn)((hwnd), (UINT)(wParam), (HMENU)(lParam)), 0L)
250 #define FORWARD_WM_MENUCOMMAND(hwnd, nPos, hMenu, fn) \
251 (void)((fn)((hwnd), WM_MENURBUTTONUP, (WPARAM)(UINT)(nPos), \
252 (LPARAM)(HMENU)(hMenu)), 0L)
253 #endif
254
255 /* void Cls_OnChangeUIState(HWND hwnd, UINT nAction, UINT nUIElement) */
256 #ifndef HANDLE_WM_CHANGEUISTATE
257 #define HANDLE_WM_CHANGEUISTATE(hwnd, wParam, lParam, fn) \
258 ((fn)((hwnd), (UINT)LOWORD(wParam), (UINT)HIWORD(wParam)), 0L)
259 #define FORWARD_WM_CHANGEUISTATE(hwnd, nAction, nUIElement, fn) \
260 (void)((fn)((hwnd), WM_CHANGEUISTATE, MAKEWPARAM((nAction), (nUIElement)), 0L), 0L)
261 #endif
262
263 /* void Cls_OnUpdateUIState(HWND hwnd, UINT nAction, UINT nUIElement) */
264 #ifndef HANDLE_WM_UPDATEUISTATE
265 #define HANDLE_WM_UPDATEUISTATE(hwnd, wParam, lParam, fn) \
266 ((fn)((hwnd), (UINT)LOWORD(wParam), (UINT)HIWORD(wParam)), 0L)
267 #define FORWARD_WM_UPDATEUISTATE(hwnd, nAction, nUIElement, fn) \
268 (void)((fn)((hwnd), WM_UPDATEUISTATE, MAKEWPARAM((nAction), (nUIElement)), 0L), 0L)
269 #endif
270
271 /* UINT Cls_OnQueryUIState(HWND hwnd) */
272 #ifndef HANDLE_WM_QUERYUISTATE
273 #define HANDLE_WM_QUERYUISTATE(hwnd, wParam, lParam, fn) \
274 (LRESULT)(UINT)(fn)((hwnd))
275 #define FORWARD_WM_QUERYUISTATE(hwnd, fn) \
276 (UINT)(fn)((hwnd), WM_QUERYUISTATE, 0, 0L)
277 #endif
278
279 /* void Cls_OnXButtonDown(HWND hwnd, BOOL fDoubleClick, WORD fwKeys, WORD fwButton, INT xPos, INT yPos) */
280 #ifndef HANDLE_WM_XBUTTONDOWN
281 #define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \
282 (LRESULT)((fn)((hwnd), FALSE, GET_KEYSTATE_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
283 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
284 #define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
285 (LRESULT)((fn)((hwnd), TRUE, GET_KEYSTATE_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
286 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
287 #define FORWARD_WM_XBUTTONDOWN(hwnd, fDoubleClick, fwKeys, fwButton, xPos, yPos, fn) \
288 (void)((fn)((hwnd), ((fDoubleClick) ? WM_XBUTTONDBLCLK : WM_XBUTTONDOWN), \
289 MAKEWPARAM((fwKeys), (fwButton)), MAKELPARAM((xPos), (yPos))), 0L)
290 #endif
291
292 /* void Cls_OnXButtonUp(HWND hwnd, WORD fwKeys, WORD fwButton, INT xPos, INT yPos) */
293 #ifndef HANDLE_WM_XBUTTONUP
294 #define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \
295 (LRESULT)((fn)((hwnd), GET_KEYSTATE_WPARAM(wParam), GET_XBUTTON_WPARAM(wParam), \
296 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), TRUE)
297 #define FORWARD_WM_XBUTTONUP(hwnd, fDoubleClick, fwKeys, fwButton, xPos, yPos, fn) \
298 (void)((fn)((hwnd), WM_XBUTTONUP, MAKEWPARAM((fwKeys), (fwButton)), \
299 MAKELPARAM((xPos), (yPos))), 0L)
300 #endif
301
302 /* void Cls_OnEnterMenuLoop(HWND hwnd, BOOL bIsTrackPopupMenu) */
303 #ifndef HANDLE_WM_ENTERMENULOOP
304 #define HANDLE_WM_ENTERMENULOOP(hwnd, wParam, lParam, fn) \
305 ((fn)((hwnd), (BOOL)(wParam)), 0L)
306 #define FORWARD_WM_ENTERMENULOOP(hwnd, bIsTrackPopupMenu, fn) \
307 (void)((fn)((hwnd), WM_ENTERMENULOOP, (BOOL)(bIsTrackPopupMenu), 0L), 0L)
308 #endif
309
310 /* void Cls_OnExitMenuLoop(HWND hwnd, BOOL bIsTrackPopupMenu) */
311 #ifndef HANDLE_WM_EXITMENULOOP
312 #define HANDLE_WM_EXITMENULOOP(hwnd, wParam, lParam, fn) \
313 ((fn)((hwnd), (BOOL)(wParam)), 0L)
314 #define FORWARD_WM_EXITMENULOOP(hwnd, bIsTrackPopupMenu, fn) \
315 (void)((fn)((hwnd), WM_EXITMENULOOP, (BOOL)(bIsTrackPopupMenu), 0L), 0L)
316 #endif
317
318 /* void Cls_OnNextMenu(HWND hwnd, INT nCode, LPMDINEXTMENU lpMDINextMenu) */
319 #ifndef HANDLE_WM_NEXTMENU
320 #define HANDLE_WM_NEXTMENU(hwnd, wParam, lParam, fn) \
321 ((fn)((hwnd), (INT)(wParam), (LPMDINEXTMENU)(lParam)), 0L)
322 #define FORWARD_WM_NEXTMENU(hwnd, nCode, lpMDINextMenu, fn) \
323 (void)((fn)((hwnd), WM_NEXTMENU, (WPARAM)(INT)(nCode), \
324 (LPARAM)(LPMDINEXTMENU)(lpMDINextMenu)), 0L)
325 #endif
326
327 /* void Cls_OnSizing(HWND hwnd, UINT nSide, LPRECT lpRect) */
328 #ifndef HANDLE_WM_SIZING
329 #define HANDLE_WM_SIZING(hwnd, wParam, lParam, fn) \
330 ((fn)((hwnd), (UINT)(wParam), (LPRECT)(lParam)), 0L)
331 #define FORWARD_WM_SIZING(hwnd, nSide, lpRect, fn) \
332 (void)((fn)((hwnd), WM_SIZING, (WPARAM)(UINT)(nSide), (LPARAM)(LPRECT)(lpRect)), 0L)
333 #endif
334
335 /* void Cls_OnCaptureChanged(HWND hwnd, HWND hwndNewCapture) */
336 #ifndef HANDLE_WM_CAPTURECHANGED
337 #define HANDLE_WM_CAPTURECHANGED(hwnd, wParam, lParam, fn) \
338 ((fn)((hwnd), (HWND)(lParam)), 0L)
339 #define FORWARD_WM_CAPTURECHANGED(hwnd, hwndNewCapture, fn) \
340 (void)((fn)((hwnd), WM_CAPTURECHANGED, 0, (LPARAM)(HWND)(hwndNewCapture)), 0L)
341 #endif
342
343 /* void Cls_OnMoving(HWND hwnd, UINT nSide, LPRECT lpRect) */
344 #ifndef HANDLE_WM_MOVING
345 #define HANDLE_WM_MOVING(hwnd, wParam, lParam, fn) \
346 ((fn)((hwnd), (UINT)(wParam), (LPRECT)(lParam)), 0L)
347 #define FORWARD_WM_MOVING(hwnd, nSide, lpRect, fn) \
348 (void)((fn)((hwnd), WM_MOVING, (WPARAM)(UINT)(nSide), (LPARAM)(LPRECT)(lpRect)), 0L)
349 #endif
350
351 /* LRESULT Cls_OnPowerBroadcast(HWND hwnd, UINT nPowerEvent, UINT nEventData) */
352 #ifndef HANDLE_WM_POWERBROADCAST
353 #define HANDLE_WM_POWERBROADCAST(hwnd, wParam, lParam, fn) \
354 (LRESULT)(fn)((hwnd), (UINT)(wParam), (UINT)(lParam))
355 #define FORWARD_WM_POWERBROADCAST(hwnd, nPowerEvent, nEventData, fn) \
356 (LRESULT)(fn)((hwnd), WM_POWERBROADCAST, (WPARAM)(UINT)(nPowerEvent), \
357 (LPARAM)(UINT)(nEventData))
358 #endif
359
360 /* HMENU Cls_MDIRefreshMenu(HWND hwnd) */
361 #ifndef HANDLE_WM_MDIREFRESHMENU
362 #define HANDLE_WM_MDIREFRESHMENU(hwnd, wParam, lParam, fn) \
363 (LRESULT)(HMENU)(fn)((hwnd))
364 #define FORWARD_WM_MDIREFRESHMENU(hwnd, fn) \
365 (HMENU)(fn)((hwnd), WM_MDIREFRESHMENU, 0, 0L)
366 #endif
367
368 /* BOOL Cls_OnImeSetContext(HWND hwnd, BOOL fActive, DWORD dwShow) */
369 #ifndef HANDLE_WM_IME_SETCONTEXT
370 #define HANDLE_WM_IME_SETCONTEXT(hwnd, wParam, lParam, fn) \
371 (LRESULT)(BOOL)(fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam))
372 #define FORWARD_WM_IME_SETCONTEXT(hwnd, fActive, dwShow, fn) \
373 (BOOL)(fn)((hwnd), WM_IME_SETCONTEXT, (WPARAM)(BOOL)(fActive), (LPARAM)(DWORD)(dwShow))
374 #endif
375
376 /* LRESULT Cls_OnImeNotify(HWND hwnd, WPARAM wSubMessage, LPARAM lParam) */
377 #ifndef HANDLE_WM_IME_NOTIFY
378 #define HANDLE_WM_IME_NOTIFY(hwnd, wParam, lParam, fn) \
379 (LRESULT)(fn)((hwnd), (WPARAM)(wParam), (LPARAM)(lParam))
380 #define FORWARD_WM_IME_NOTIFY(hwnd, wSubMessage, lParam, fn) \
381 (LRESULT)(fn)((hwnd), WM_IME_NOTIFY, (WPARAM)(wSubMessage), (LPARAM)(lParam))
382 #endif
383
384 /* LRESULT Cls_OnImeControl(HWND hwnd, WPARAM wSubMessage, LPVOID lpData) */
385 #ifndef HANDLE_WM_IME_CONTROL
386 #define HANDLE_WM_IME_CONTROL(hwnd, wParam, lParam, fn) \
387 (LRESULT)(fn)((hwnd), (WPARAM)(wParam), (LPVOID)(lParam))
388 #define FORWARD_WM_IME_CONTROL(hwnd, wSubMessage, lpData, fn) \
389 (LRESULT)(fn)((hwnd), WM_IME_CONTROL, (WPARAM)(wSubMessage), (LPARAM)(LPVOID)(lpData))
390 #endif
391
392 /* void Cls_OnImeCompositionFull(HWND hwnd) */
393 #ifndef HANDLE_WM_IME_COMPOSITIONFULL
394 #define HANDLE_WM_IME_COMPOSITIONFULL(hwnd, wParam, lParam, fn) \
395 ((fn)((hwnd)), 0L)
396 #define FORWARD_WM_IME_COMPOSITIONFULL(hwnd, compactRatio, fn) \
397 (void)((fn)((hwnd), WM_IME_COMPOSITIONFULL, 0, 0L), 0L)
398 #endif
399
400 /* void Cls_OnImeSelect(HWND hwnd, BOOL fSelect, HKL hKL) */
401 #ifndef HANDLE_WM_IME_SELECT
402 #define HANDLE_WM_IME_SELECT(hwnd, wParam, lParam, fn) \
403 ((fn)((hwnd), (BOOL)(wParam), (HKL)(lParam)), 0L)
404 #define FORWARD_WM_IME_SELECT(hwnd, fSelect, hKL, fn) \
405 (void)((fn)((hwnd), WM_IME_SELECT, (WPARAM)(BOOL)(fSelect), (LPARAM)(HKL)(hKL)), 0L)
406 #endif
407
408 /* void Cls_OnImeChar(HWND hwnd, WORD wCharCode, LONG lKeyData) */
409 #ifndef HANDLE_WM_IME_CHAR
410 #define HANDLE_WM_IME_CHAR(hwnd, wParam, lParam, fn) \
411 ((fn)((hwnd), (WORD)(wParam), (LONG)(lParam)), 0L)
412 #define FORWARD_WM_IME_CHAR(hwnd, wCharCode, lKeyData, fn) \
413 (void)((fn)((hwnd), WM_IME_CHAR, (WPARAM)(WORD)(wCharCode), (LPARAM)(LONG)(lKeyData)), 0L)
414 #endif
415
416 /* LRESULT Cls_OnImeRequest(HWND hwnd, WPARAM wParam, LPARAM lParam) */
417 #ifndef HANDLE_WM_IME_REQUEST
418 #define HANDLE_WM_IME_REQUEST(hwnd, wParam, lParam, fn) \
419 (LRESULT)(fn)((hwnd), (WPARAM)(wParam), (LPARAM)(lParam))
420 #define FORWARD_WM_IME_REQUEST(hwnd, wParam, lParam, fn) \
421 (LRESULT)(fn)((hwnd), WM_IME_REQUEST, (WPARAM)(wParam), (LPARAM)(lParam))
422 #endif
423
424 /* void Cls_OnImeKey(HWND hwnd, BOOL fDown, UINT nVirtKey, LONG lKeyData) */
425 #ifndef HANDLE_WM_IME_KEYDOWN
426 #define HANDLE_WM_IME_KEYDOWN(hwnd, wParam, lParam, fn) \
427 ((fn)((hwnd), TRUE, (WORD)(wParam), (LONG)(lParam)), 0L)
428 #define FORWARD_WM_IME_KEYDOWN(hwnd, fDown, nVirtKey, lKeyData, fn) \
429 (void)((fn)((hwnd), ((BOOL)(fDown) ? WM_IME_KEYDOWN : WM_IME_KEYUP), \
430 (WPARAM)(UINT)(nVirtKey), (LPARAM)(LONG)(lKeyData)), 0L)
431 #define HANDLE_WM_IME_KEYUP(hwnd, wParam, lParam, fn) \
432 ((fn)((hwnd), FALSE, (WORD)(wParam), (LONG)(lParam)), 0L)
433 #define FORWARD_WM_IME_KEYUP(hwnd, fDown, nVirtKey, lKeyData, fn) \
434 (void)((fn)((hwnd), ((BOOL)(fDown) ? WM_IME_KEYDOWN : WM_IME_KEYUP), \
435 (WPARAM)(UINT)(nVirtKey), (LPARAM)(LONG)(lKeyData)), 0L)
436 #endif
437
438 /* void Cls_OnMouseHover(HWND hwnd, UINT nFlags, INT xPos, INT yPos) */
439 #ifndef HANDLE_WM_MOUSEHOVER
440 #define HANDLE_WM_MOUSEHOVER(hwnd, wParam, lParam, fn) \
441 ((fn)((hwnd), (UINT)(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), 0L)
442 #define FORWARD_WM_MOUSEHOVER(hwnd, nFlags, xPos, yPos, fn) \
443 (void)((fn)((hwnd), WM_MOUSEHOVER, (WPARAM)(UINT)(nFlags), \
444 MAKELPARAM((xPos), (yPos))), 0L)
445 #endif
446
447 /* void Cls_OnMouseLeave(HWND hwnd) */
448 #ifndef HANDLE_WM_MOUSELEAVE
449 #define HANDLE_WM_MOUSELEAVE(hwnd, wParam, lParam, fn) \
450 ((fn)((hwnd)), 0L)
451 #define FORWARD_WM_MOUSELEAVE(hwnd, fn) \
452 (void)((fn)((hwnd), WM_MOUSELEAVE, 0, 0L), 0L)
453 #endif
454
455 /* void Cls_OnNCMouseHover(HWND hwnd, UINT nHitTest, INT xPos, INT yPos) */
456 #ifndef HANDLE_WM_NCMOUSEHOVER
457 #define HANDLE_WM_NCMOUSEHOVER(hwnd, wParam, lParam, fn) \
458 ((fn)((hwnd), (INT)(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), 0L)
459 #define FORWARD_WM_NCMOUSEHOVER(hwnd, nHitTest, xPos, yPos, fn) \
460 (void)((fn)((hwnd), WM_NCMOUSEHOVER, (WPARAM)(UINT)(nHitTest), \
461 MAKELPARAM((xPos), (yPos))), 0L)
462 #endif
463
464 /* void Cls_OnNCMouseLeave(HWND hwnd) */
465 #ifndef HANDLE_WM_NCMOUSELEAVE
466 #define HANDLE_WM_NCMOUSELEAVE(hwnd, wParam, lParam, fn) \
467 ((fn)((hwnd)), 0L)
468 #define FORWARD_WM_NCMOUSELEAVE(hwnd, fn) \
469 (void)((fn)((hwnd), WM_NCMOUSELEAVE, 0, 0L), 0L)
470 #endif
471
472 /* void Cls_OnPrint(HWND hwnd, HDC hDC, UINT uFlags) */
473 #ifndef HANDLE_WM_PRINT
474 #define HANDLE_WM_PRINT(hwnd, wParam, lParam, fn) \
475 ((fn)((hwnd), (HDC)(wParam), (UINT)(lParam)), 0L)
476 #define FORWARD_WM_PRINT(hwnd, hDC, uFlags, fn) \
477 (void)((fn)((hwnd), WM_PRINT, (WPARAM)(HDC)(hDC), (LPARAM)(uFlags)), 0L)
478 #endif
479
480 /* void Cls_OnPrintClient(HWND hwnd, HDC hDC, UINT uFlags) */
481 #ifndef HANDLE_WM_PRINTCLIENT
482 #define HANDLE_WM_PRINTCLIENT(hwnd, wParam, lParam, fn) \
483 ((fn)((hwnd), (HDC)(wParam), (UINT)(lParam)), 0L)
484 #define FORWARD_WM_PRINTCLIENT(hwnd, hDC, uFlags, fn) \
485 (void)((fn)((hwnd), WM_PRINTCLIENT, (WPARAM)(HDC)(hDC), (LPARAM)(uFlags)), 0L)
486 #endif
487
488 /* BOOL Cls_OnAppCommand(HWND hwnd, HWND hwndTarget, UINT cmd, UINT nDevice, UINT nKey) */
489 #ifndef HANDLE_WM_APPCOMMAND
490 #define HANDLE_WM_APPCOMMAND(hwnd, wParam, lParam, fn) \
491 (LRESULT)(BOOL)(fn)((hwnd), (HWND)(wParam), GET_APPCOMMAND_LPARAM(lParam), \
492 GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam))
493 #define FORWARD_WM_APPCOMMAND(hwnd, hwndTarget, cmd, nDevice, nKey, fn) \
494 (BOOL)(fn)((hwnd), WM_APPCOMMAND, (WPARAM)(hwndTarget), \
495 MAKELPARAM((nKey), ((WORD)(cmd)) | (UINT)(nDevice)))
496 #endif
497
498 /* void Cls_OnEnterSizeMove(HWND hwnd) */
499 #ifndef HANDLE_WM_ENTERSIZEMOVE
500 #define HANDLE_WM_ENTERSIZEMOVE(hwnd, wParam, lParam, fn) \
501 ((fn)((hwnd)), 0L)
502 #define FORWARD_WM_ENTERSIZEMOVE(hwnd, fn) \
503 (void)((fn)((hwnd), WM_ENTERSIZEMOVE, 0, 0L), 0L)
504 #endif
505
506 /* void Cls_OnExitSizeMove(HWND hwnd) */
507 #ifndef HANDLE_WM_EXITSIZEMOVE
508 #define HANDLE_WM_EXITSIZEMOVE(hwnd, wParam, lParam, fn) \
509 ((fn)((hwnd)), 0L)
510 #define FORWARD_WM_EXITSIZEMOVE(hwnd, fn) \
511 (void)((fn)((hwnd), WM_EXITSIZEMOVE, 0, 0L), 0L)
512 #endif
513
514 /* HICON Cls_OnQueryDragIcon(HWND hwnd) */
515 #undef HANDLE_WM_QUERYDRAGICON
516 #define HANDLE_WM_QUERYDRAGICON(hwnd, wParam, lParam, fn) \
517 (LRESULT)(DWORD)(UINT)(UINT_PTR)(fn)(hwnd)
518 #undef FORWARD_WM_QUERYDRAGICON
519 #define FORWARD_WM_QUERYDRAGICON(hwnd, fn) \
520 (HICON)(UINT_PTR)(UINT)(DWORD)(fn)((hwnd), WM_QUERYDRAGICON, 0L, 0L)
521
522 /* HWND Cls_MDICreate(HWND hwnd, const LPMDICREATESTRUCT lpmcs) */
523 #undef HANDLE_WM_MDICREATE
524 #define HANDLE_WM_MDICREATE(hwnd, wParam, lParam, fn) \
525 (LRESULT)(DWORD)(UINT)(UINT_PTR)(fn)((hwnd), (LPMDICREATESTRUCT)(lParam))
526 #undef FORWARD_WM_MDICREATE
527 #define FORWARD_WM_MDICREATE(hwnd, lpmcs, fn) \
528 (HWND)(UINT_PTR)(fn)((hwnd), WM_MDICREATE, 0L, (LPARAM)(LPMDICREATESTRUCT)(lpmcs))
529
530 /* BOOL Cls_OnNCActivate(HWND hwnd, BOOL fActive, HWND hwndActDeact, BOOL fMinimized) */
531 #undef HANDLE_WM_NCACTIVATE
532 #define HANDLE_WM_NCACTIVATE(hwnd, wParam, lParam, fn) \
533 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (BOOL)(wParam), 0L, 0L)
534 #undef FORWARD_WM_NCACTIVATE
535 #define FORWARD_WM_NCACTIVATE(hwnd, fActive, hwndActDeact, fMinimized, fn) \
536 (BOOL)(DWORD)(fn)((hwnd), WM_NCACTIVATE, (WPARAM)(BOOL)(fActive), 0L)
537
538 /* LONG Edit_OnGetSel(HWND hwnd, LPDWORD lpdwStart, LPDWORD lpdwEnd) */
539 #define HANDLE_EM_GETSEL(hwnd, wParam, lParam, fn) \
540 (LRESULT)(LONG)(fn)((hwnd), (LPDWORD)(wParam), (LPDWORD)(lParam))
541
542 /* void Edit_OnSetSel(HWND hwnd, INT nStart, INT nEnd) */
543 #define HANDLE_EM_SETSEL(hwnd, wParam, lParam, fn) \
544 ((fn)((hwnd), (INT)(wParam), (INT)(lParam)), 0L)
545
546 /* void Edit_OnGetRect(HWND hwnd, LPRECT prc) */
547 #define HANDLE_EM_GETRECT(hwnd, wParam, lParam, fn) \
548 ((fn)((hwnd), (LPRECT)(lParam)), 0L)
549
550 /* void Edit_OnSetRect(HWND hwnd, LPCRECT prc) */
551 #define HANDLE_EM_SETRECT(hwnd, wParam, lParam, fn) \
552 ((fn)((hwnd), (LPCRECT)(lParam)), 0L)
553
554 /* void Edit_OnSetRectNP(HWND hwnd, LPCRECT prc) */
555 #define HANDLE_EM_SETRECTNP(hwnd, wParam, lParam, fn) \
556 ((fn)((hwnd), (LPCRECT)(lParam)), 0L)
557
558 /* DWORD Edit_OnScroll(HWND hwnd, INT nScroll) */
559 #define HANDLE_EM_SCROLL(hwnd, wParam, lParam, fn) \
560 (LRESULT)(DWORD)(fn)((hwnd), (INT)(wParam))
561
562 /* BOOL Edit_OnLineScroll(HWND hwnd, INT cxScroll, INT cyScroll) */
563 #define HANDLE_EM_LINESCROLL(hwnd, wParam, lParam, fn) \
564 (LRESULT)(BOOL)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
565
566 /* BOOL Edit_OnScrollCaret(HWND hwnd) */
567 #define HANDLE_EM_SCROLLCARET(hwnd, wParam, lParam, fn) \
568 (LRESULT)(BOOL)(fn)((hwnd))
569
570 /* BOOL Edit_OnGetModify(HWND hwnd) */
571 #define HANDLE_EM_GETMODIFY(hwnd, wParam, lParam, fn) \
572 (LRESULT)(BOOL)(fn)((hwnd))
573
574 /* void Edit_OnSetModify(HWND hwnd, BOOL fModified) */
575 #define HANDLE_EM_SETMODIFY(hwnd, wParam, lParam, fn) \
576 ((fn)((hwnd), (BOOL)(wParam)), 0L)
577
578 /* INT Edit_OnGetLineCount(HWND hwnd) */
579 #define HANDLE_EM_GETLINECOUNT(hwnd, wParam, lParam, fn) \
580 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
581
582 /* INT Edit_OnLineIndex(HWND hwnd, INT line) */
583 #define HANDLE_EM_LINEINDEX(hwnd, wParam, lParam, fn) \
584 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
585
586 /* void Edit_OnSetHandle(HWND hwnd, HLOCAL hloc) */
587 #define HANDLE_EM_SETHANDLE(hwnd, wParam, lParam, fn) \
588 ((fn)((hwnd), (HLOCAL)(wParam)), 0L)
589
590 /* HLOCAL Edit_OnGetHandle(HWND hwnd) */
591 #define HANDLE_EM_GETHANDLE(hwnd, wParam, lParam, fn) \
592 (LRESULT)(HLOCAL)(fn)((hwnd))
593
594 /* INT Edit_OnGetThumb(HWND hwnd) */
595 #define HANDLE_EM_GETTHUMB(hwnd, wParam, lParam, fn) \
596 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
597
598 /* INT Edit_OnLineLength(HWND hwnd, INT ich) */
599 #define HANDLE_EM_LINELENGTH(hwnd, wParam, lParam, fn) \
600 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
601
602 /* void Edit_OnReplaceSel(HWND hwnd, BOOL fCanUndo, LPCTSTR lpszReplace) */
603 #define HANDLE_EM_REPLACESEL(hwnd, wParam, lParam, fn) \
604 ((fn)((hwnd), (BOOL)(wParam), (LPCTSTR)(lParam)), 0L)
605
606 /* INT Edit_OnGetLine(HWND hwnd, INT line, LPCTSTR lpch) */
607 #define HANDLE_EM_GETLINE(hwnd, wParam, lParam, fn) \
608 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
609
610 /* NOTE: EM_LIMITTEXT is same value as EM_SETLIMITTEXT */
611 /* void Edit_OnLimitText(HWND hwnd, LONG cchMax) */
612 #define HANDLE_EM_LIMITTEXT(hwnd, wParam, lParam, fn) \
613 ((fn)((hwnd), (LONG)(wParam)), 0L)
614
615 /* BOOL Edit_OnCanUndo(HWND hwnd) */
616 #define HANDLE_EM_CANUNDO(hwnd, wParam, lParam, fn) \
617 (LRESULT)(BOOL)(fn)((hwnd))
618
619 /* BOOL Edit_OnUndo(HWND hwnd) */
620 #define HANDLE_EM_UNDO(hwnd, wParam, lParam, fn) \
621 (LRESULT)(BOOL)(fn)((hwnd))
622
623 /* BOOL Edit_OnFmtLines(HWND hwnd, BOOL fAddEOL) */
624 #define HANDLE_EM_FMTLINES(hwnd, wParam, lParam, fn) \
625 (LRESULT)(BOOL)(fn)((hwnd), (BOOL)(wParam))
626
627 /* INT Edit_OnLineFromChar(HWND hwnd, INT ich) */
628 #define HANDLE_EM_LINEFROMCHAR(hwnd, wParam, lParam, fn) \
629 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
630
631 /* BOOL Edit_OnSetTabStops(HWND hwnd, INT cTabs, LPDWORD lpdwTabs) */
632 #define HANDLE_EM_SETTABSTOPS(hwnd, wParam, lParam, fn) \
633 (LRESULT)(BOOL)(fn)((hwnd), (INT)(wParam), (LPDWORD)(lParam))
634
635 /* void Edit_OnSetPasswordChar(HWND hwnd, UINT ch) */
636 #define HANDLE_EM_SETPASSWORDCHAR(hwnd, wParam, lParam, fn) \
637 ((fn)((hwnd), (UINT)(wParam)), 0L)
638
639 /* void Edit_OnEmptyUndoBuffer(HWND hwnd) */
640 #define HANDLE_EM_EMPTYUNDOBUFFER(hwnd, wParam, lParam, fn) \
641 ((fn)((hwnd)), 0L)
642
643 /* INT Edit_OnGetFirstVisibleLine(HWND hwnd) */
644 #define HANDLE_EM_GETFIRSTVISIBLELINE(hwnd, wParam, lParam, fn) \
645 (INT)((fn)((hwnd)), 0L)
646
647 /* BOOL Edit_OnSetReadOnly(HWND hwnd, BOOL fReadOnly) */
648 #define HANDLE_EM_SETREADONLY(hwnd, wParam, lParam, fn) \
649 (BOOL)(fn)((hwnd), (BOOL)(wParam))
650
651 /* void Edit_OnSetWordBreakProc(HWND hwnd, EDITWORDBREAKPROC ewbprc) */
652 #define HANDLE_EM_SETWORDBREAKPROC(hwnd, wParam, lParam, fn) \
653 ((fn)((hwnd), (EDITWORDBREAKPROC)(lParam)), 0L)
654
655 /* EDITWORDBREAKPROC Edit_OnGetWordBreakProc(HWND hwnd) */
656 #define HANDLE_EM_GETWORDBREAKPROC(hwnd, wParam, lParam, fn) \
657 (LRESULT)(EDITWORDBREAKPROC)(fn)((hwnd))
658
659 /* UINT Edit_OnGetPasswordChar(HWND hwnd) */
660 #define HANDLE_EM_GETPASSWORDCHAR(hwnd, wParam, lParam, fn) \
661 (LRESULT)(UINT)(UINT)(fn)((hwnd))
662
663 /* void Edit_OnSetMargins(HWND hwnd, UINT fwMargin, WORD wLeft, WORD wRight) */
664 #define HANDLE_EM_SETMARGINS(hwnd, wParam, lParam, fn) \
665 ((fn)((hwnd), (UINT)(wParam), LOWORD(lParam), HIWORD(lParam)), 0L)
666
667 /* DWORD Edit_OnGetMargins(HWND hwnd) */
668 #define HANDLE_EM_GETMARGINS(hwnd, wParam, lParam, fn) \
669 (LRESULT)(DWORD)(fn)((hwnd))
670
671 /* void Edit_OnSetLimitText(HWND hwnd, DWORD cbMax) */
672 #define HANDLE_EM_SETLIMITTEXT(hwnd, wParam, lParam, fn) \
673 ((fn)((hwnd), (DWORD)(wParam)), 0L)
674
675 /* DWORD Edit_OnGetLimitText(HWND hwnd) */
676 #define HANDLE_EM_GETLIMITTEXT(hwnd, wParam, lParam, fn) \
677 (LRESULT)(DWORD)(fn)((hwnd))
678
679 /* void Edit_OnPosFromChar(HWND hwnd, LPPOINT lpPoint, UINT wCharIndex) */
680 #define HANDLE_EM_POSFROMCHAR(hwnd, wParam, lParam, fn) \
681 ((fn)((hwnd), (LPPOINT)(wParam), (UINT)(lParam)), 0L)
682
683 /* LONG Edit_OnCharFromPos(HWND hwnd, INT x, INT y) */
684 #define HANDLE_EM_CHARFROMPOS(hwnd, wParam, lParam, fn) \
685 (LRESULT)(LONG)(fn)((hwnd), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
686
687 /* DWORD Edit_OnSetImeStatus(HWND hwnd, UINT uType, DWORD dwFlags) */
688 #define HANDLE_EM_SETIMESTATUS(hwnd, wParam, lParam, fn) \
689 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam), (DWORD)(lParam))
690
691 /* DWORD Edit_OnGetImeStatus(HWND hwnd, UINT uType) */
692 #define HANDLE_EM_GETIMESTATUS(hwnd, wParam, lParam, fn) \
693 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
694
695 /* HICON Static_OnSetIcon(HWND hwnd, HICON hIcon) */
696 #define HANDLE_STM_SETICON(hwnd, wParam, lParam, fn) \
697 (LRESULT)(HICON)(fn)((hwnd), (HICON)(wParam))
698
699 /* HICON Static_OnGetIcon(HWND hwnd) */
700 #define HANDLE_STM_GETICON(hwnd, wParam, lParam, fn) \
701 (LRESULT)(HICON)(fn)((hwnd))
702
703 /* HANDLE Static_OnSetImage(HWND hwnd, UINT fImageType, HANDLE hImage) */
704 #define HANDLE_STM_SETIMAGE(hwnd, wParam, lParam, fn) \
705 (LRESULT)(HANDLE)(fn)((hwnd), (UINT)(wParam), (HANDLE)(lParam))
706
707 /* HANDLE Static_OnGetImage(HWND hwnd, UINT fImageType) */
708 #define HANDLE_STM_GETIMAGE(hwnd, wParam, lParam, fn) \
709 (LRESULT)(HANDLE)(fn)((hwnd), (UINT)(wParam))
710
711 /* INT ListBox_OnAddString(HWND hwnd, LPCTSTR lpsz) */
712 #define HANDLE_LB_ADDSTRING(hwnd, wParam, lParam, fn) \
713 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (LPCTSTR)(lParam))
714
715 /* INT ListBox_OnInsertString(HWND hwnd, INT index, LPCTSTR lpsz) */
716 #define HANDLE_LB_INSERTSTRING(hwnd, wParam, lParam, fn) \
717 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
718
719 /* INT ListBox_OnDeleteString(HWND hwnd, INT index) */
720 #define HANDLE_LB_DELETESTRING(hwnd, wParam, lParam, fn) \
721 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
722
723 /* INT ListBox_OnSelItemRangeEx(HWND hwnd, UINT wFirst, UINT wLast) */
724 #define HANDLE_LB_SELITEMRANGEEX(hwnd, wParam, lParam, fn) \
725 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (UINT)(wParam), (UINT)(lParam))
726
727 /* void ListBox_OnResetContent(HWND hwnd) */
728 #define HANDLE_LB_RESETCONTENT(hwnd, wParam, lParam, fn) \
729 ((fn)((hwnd)), 0L)
730
731 /* INT ListBox_OnSetSel(HWND hwnd, BOOL fSelect, UINT index) */
732 #define HANDLE_LB_SETSEL(hwnd, wParam, lParam, fn) \
733 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (BOOL)(wParam), (UINT)(lParam))
734
735 /* INT ListBox_OnSetCurSel(HWND hwnd, INT index) */
736 #define HANDLE_LB_SETCURSEL(hwnd, wParam, lParam, fn) \
737 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
738
739 /* INT ListBox_OnGetSel(HWND hwnd, INT index) */
740 #define HANDLE_LB_GETSEL(hwnd, wParam, lParam, fn) \
741 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
742
743 /* INT ListBox_OnGetCurSel(HWND hwnd) */
744 #define HANDLE_LB_GETCURSEL(hwnd, wParam, lParam, fn) \
745 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
746
747 /* INT ListBox_OnGetText(HWND hwnd, INT index, LPTSTR lpszBuffer) */
748 #define HANDLE_LB_GETTEXT(hwnd, wParam, lParam, fn) \
749 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPTSTR)(lParam))
750
751 /* INT ListBox_OnGetTextLen(HWND hwnd, INT index) */
752 #define HANDLE_LB_GETTEXTLEN(hwnd, wParam, lParam, fn) \
753 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
754
755 /* INT ListBox_OnGetCount(HWND hwnd) */
756 #define HANDLE_LB_GETCOUNT(hwnd, wParam, lParam, fn) \
757 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
758
759 /* INT ListBox_OnSelectString(HWND hwnd, INT indexStart, LPCTSTR lpszFind) */
760 #define HANDLE_LB_SELECTSTRING(hwnd, wParam, lParam, fn) \
761 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
762
763 /* INT ListBox_OnDir(HWND hwnd, UINT uAttrs, LPCTSTR lpszFileSpec) */
764 #define HANDLE_LB_DIR(hwnd, wParam, lParam, fn) \
765 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (UINT)(wParam), (LPCTSTR)(lParam))
766
767 /* INT ListBox_OnGetTopIndex(HWND hwnd) */
768 #define HANDLE_LB_GETTOPINDEX(hwnd, wParam, lParam, fn) \
769 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
770
771 /* INT ListBox_OnFindString(HWND hwnd, INT indexStart, LPCTSTR lpszFind) */
772 #define HANDLE_LB_FINDSTRING(hwnd, wParam, lParam, fn) \
773 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
774
775 /* INT ListBox_OnGetSelCount(HWND hwnd) */
776 #define HANDLE_LB_GETSELCOUNT(hwnd, wParam, lParam, fn) \
777 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
778
779 /* INT ListBox_OnGetSelItems(HWND hwnd, UINT cItems, LPINT lpnItems) */
780 #define HANDLE_LB_GETSELITEMS(hwnd, wParam, lParam, fn) \
781 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (UINT)(wParam), (LPINT)(lParam))
782
783 /* BOOL ListBox_OnSetTabStops(HWND hwnd, UINT cTabs, LPINT lpnTabs) */
784 #define HANDLE_LB_SETTABSTOPS(hwnd, wParam, lParam, fn) \
785 (LRESULT)(BOOL)(fn)((hwnd), (UINT)(wParam), (LPINT)(lParam))
786
787 /* INT ListBox_OnGetHorizontalExtent(HWND hwnd) */
788 #define HANDLE_LB_GETHORIZONTALEXTENT(hwnd, wParam, lParam, fn) \
789 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
790
791 /* void ListBox_OnSetHorizontalExtent(HWND hwnd, INT cxExtent) */
792 #define HANDLE_LB_SETHORIZONTALEXTENT(hwnd, wParam, lParam, fn) \
793 ((fn)((hwnd), (INT)(wParam)), 0L)
794
795 /* void ListBox_OnSetColumnWidth(HWND hwnd, INT cxColumn) */
796 #define HANDLE_LB_SETCOLUMNWIDTH(hwnd, wParam, lParam, fn) \
797 ((fn)((hwnd), (INT)(wParam)), 0L)
798
799 /* INT ListBox_OnAddFile(HWND hwnd, LPCTSTR lpszFilename) */
800 #define HANDLE_LB_ADDFILE(hwnd, wParam, lParam, fn) \
801 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (LPCTSTR)(lParam))
802
803 /* INT ListBox_OnSetTopIndex(HWND hwnd, INT index) */
804 #define HANDLE_LB_SETTOPINDEX(hwnd, wParam, lParam, fn) \
805 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
806
807 /* INT ListBox_OnGetItemRect(HWND hwnd, INT index, RECT FAR *lprc) */
808 #define HANDLE_LB_GETITEMRECT(hwnd, wParam, lParam, fn) \
809 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (RECT FAR *)(lParam))
810
811 /* INT_PTR ListBox_OnGetItemData(HWND hwnd, INT index) */
812 #define HANDLE_LB_GETITEMDATA(hwnd, wParam, lParam, fn) \
813 (LRESULT)(INT_PTR)(fn)((hwnd), (INT)(wParam))
814
815 /* INT_PTR ListBox_OnSetItemData(HWND hwnd, INT index, LPARAM dwData) */
816 #define HANDLE_LB_SETITEMDATA(hwnd, wParam, lParam, fn) \
817 (LRESULT)(INT_PTR)(fn)((hwnd), (INT)(wParam), (lParam))
818
819 /* INT ListBox_OnSelItemRange(HWND hwnd, BOOL fSelect, UINT wFirst, UINT wLast) */
820 #define HANDLE_LB_SELITEMRANGE(hwnd, wParam, lParam, fn) \
821 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (BOOL)(wParam), LOWORD(lParam), HIWORD(lParam))
822
823 /* INT ListBox_OnSetAnchorIndex(HWND hwnd, INT index) */
824 #define HANDLE_LB_SETANCHORINDEX(hwnd, wParam, lParam, fn) \
825 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
826
827 /* INT ListBox_OnGetAnchorIndex(HWND hwnd) */
828 #define HANDLE_LB_GETANCHORINDEX(hwnd, wParam, lParam, fn) \
829 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
830
831 /* INT ListBox_OnSetCaretIndex(HWND hwnd, INT index, BOOL fScroll) */
832 #define HANDLE_LB_SETCARETINDEX(hwnd, wParam, lParam, fn) \
833 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (BOOL)LOWORD(lParam))
834
835 /* INT ListBox_OnGetCaretIndex(HWND hwnd) */
836 #define HANDLE_LB_GETCARETINDEX(hwnd, wParam, lParam, fn) \
837 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
838
839 /* INT ListBox_OnSetItemHeight(HWND hwnd, INT index, INT cyItem) */
840 #define HANDLE_LB_SETITEMHEIGHT(hwnd, wParam, lParam, fn) \
841 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (SHORT)LOWORD(lParam))
842
843 /* INT ListBox_OnGetItemHeight(HWND hwnd, INT index) */
844 #define HANDLE_LB_GETITEMHEIGHT(hwnd, wParam, lParam, fn) \
845 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
846
847 /* INT ListBox_OnFindStringExact(HWND hwnd, INT indexStart, LPCTSTR lpszFind) */
848 #define HANDLE_LB_FINDSTRINGEXACT(hwnd, wParam, lParam, fn) \
849 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
850
851 /* LCID ListBox_OnSetLocale(HWND hwnd, LCID wLocaleID) */
852 #define HANDLE_LB_SETLOCALE(hwnd, wParam, lParam, fn) \
853 (LRESULT)(LCID)(fn)((hwnd), (LCID)(wParam))
854
855 /* LCID ListBox_OnGetLocale(HWND hwnd) */
856 #define HANDLE_LB_GETLOCALE(hwnd, wParam, lParam, fn) \
857 (LRESULT)(LCID)(fn)((hwnd))
858
859 /* INT ListBox_OnSetCount(HWND hwnd, INT cItems) */
860 #define HANDLE_LB_SETCOUNT(hwnd, wParam, lParam, fn) \
861 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
862
863 /* DWORD ListBox_OnInitStorage(HWND hwnd, UINT cItems, DWORD cb) */
864 #define HANDLE_LB_INITSTORAGE(hwnd, wParam, lParam, fn) \
865 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam), (DWORD)(lParam))
866
867 /* DWORD ListBox_OnItemFromPoint(HWND hwnd, INT xPos, INT yPos) */
868 #define HANDLE_LB_ITEMFROMPOINT(hwnd, wParam, lParam, fn) \
869 (LRESULT)(DWORD)(fn)((hwnd), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
870
871 // TODO: HANDLE_LB_MULTIPLEADDSTRING and HANDLE_LB_GETLISTBOXINFO.
872
873 /* DWORD ComboBox_OnGetEditSel(HWND hwnd, LPDWORD lpdwStart, LPDWORD lpdwEnd) */
874 #define HANDLE_CB_GETEDITSEL(hwnd, wParam, lParam, fn) \
875 (LRESULT)(DWORD)(fn)((hwnd), (LPDWORD)(wParam), (LPDWORD)(lParam))
876
877 /* void ComboBox_OnLimitText(HWND hwnd, UINT cchLimit) */
878 #define HANDLE_CB_LIMITTEXT(hwnd, wParam, lParam, fn) \
879 ((fn)((hwnd), (UINT)(wParam)), TRUE)
880
881 /* INT ComboBox_OnSetEditSel(HWND hwnd, INT ichStart, INT ichEnd) */
882 #define HANDLE_CB_SETEDITSEL(hwnd, wParam, lParam, fn) \
883 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
884
885 /* INT ComboBox_OnAddString(HWND hwnd, LPCTSTR lpsz) */
886 #define HANDLE_CB_ADDSTRING(hwnd, wParam, lParam, fn) \
887 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (LPCTSTR)(lParam))
888
889 /* INT ComboBox_OnDeleteString(HWND hwnd, INT index) */
890 #define HANDLE_CB_DELETESTRING(hwnd, wParam, lParam, fn) \
891 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
892
893 /* INT ComboBox_OnDir(HWND hwnd, UINT uAttrs, LPCTSTR lpszFileSpec) */
894 #define HANDLE_CB_DIR(hwnd, wParam, lParam, fn) \
895 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (UINT)(wParam), (LPCTSTR)(lParam))
896
897 /* INT ComboBox_OnGetCount(HWND hwnd) */
898 #define HANDLE_CB_GETCOUNT(hwnd, wParam, lParam, fn) \
899 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
900
901 /* INT ComboBox_GetCurSel(HWND hwnd) */
902 #define HANDLE_CB_GETCURSEL(hwnd, wParam, lParam, fn) \
903 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
904
905 /* INT ComboBox_GetLBText(HWND hwnd, INT index, LPTSTR lpszBuffer) */
906 #define HANDLE_CB_GETLBTEXT(hwnd, wParam, lParam, fn) \
907 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPTSTR)(lParam))
908
909 /* INT ComboBox_OnGetLBTextLen(HWND hwnd, INT index) */
910 #define HANDLE_CB_GETLBTEXTLEN(hwnd, wParam, lParam, fn) \
911 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
912
913 /* INT ComboBox_OnInsertString(HWND hwnd, INT index, LPCTSTR lpsz) */
914 #define HANDLE_CB_INSERTSTRING(hwnd, wParam, lParam, fn) \
915 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
916
917 /* void ComboBox_OnResetContent(HWND hwnd) */
918 #define HANDLE_CB_RESETCONTENT(hwnd, wParam, lParam, fn) \
919 (LRESULT)((fn)((hwnd)), CB_OKAY)
920
921 /* INT ComboBox_OnFindString(HWND hwnd, INT indexStart, LPCTSTR lpszFind) */
922 #define HANDLE_CB_FINDSTRING(hwnd, wParam, lParam, fn) \
923 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
924
925 /* INT ComboBox_OnSelectString(HWND hwnd, INT indexStart, LPCTSTR lpszSelect) */
926 #define HANDLE_CB_SELECTSTRING(hwnd, wParam, lParam, fn) \
927 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
928
929 /* INT ComboBox_OnSetCurSel(HWND hwnd, INT index) */
930 #define HANDLE_CB_SETCURSEL(hwnd, wParam, lParam, fn) \
931 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
932
933 /* BOOL ComboBox_OnShowDropDown(HWND hwnd, BOOL fShow) */
934 #define HANDLE_CB_SHOWDROPDOWN(hwnd, wParam, lParam, fn) \
935 (LRESULT)((fn)((hwnd), (BOOL)(wParam)), TRUE)
936
937 /* INT_PTR ComboBox_OnGetItemData(HWND hwnd, INT index) */
938 #define HANDLE_CB_GETITEMDATA(hwnd, wParam, lParam, fn) \
939 (LRESULT)(INT_PTR)(fn)((hwnd), (INT)(wParam))
940
941 /* INT_PTR ComboBox_OnSetItemData(HWND hwnd, INT index, DWORD_PTR dwData) */
942 #define HANDLE_CB_SETITEMDATA(hwnd, wParam, lParam, fn) \
943 (LRESULT)(INT_PTR)(fn)((hwnd), (INT)(wParam), (DWORD_PTR)(lParam))
944
945 /* void ComboBox_OnGetDroppedControlRect(HWND hwnd, RECT FAR *lprc) */
946 #define HANDLE_CB_GETDROPPEDCONTROLRECT(hwnd, wParam, lParam, fn) \
947 (LRESULT)((fn)((hwnd), (RECT FAR *)(lParam)), CB_OKAY)
948
949 /* INT ComboBox_OnSetItemHeight(HWND hwnd, INT index, INT height) */
950 #define HANDLE_CB_SETITEMHEIGHT(hwnd, wParam, lParam, fn) \
951 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
952
953 /* INT ComboBox_OnGetItemHeight(HWND hwnd, INT index) */
954 #define HANDLE_CB_GETITEMHEIGHT(hwnd, wParam, lParam, fn) \
955 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
956
957 /* INT ComboBox_OnSetExtendedUI(HWND hwnd, BOOL fExtended) */
958 #define HANDLE_CB_SETEXTENDEDUI(hwnd, wParam, lParam, fn) \
959 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (BOOL)(wParam))
960
961 /* BOOL ComboBox_OnGetExtendedUI(HWND hwnd) */
962 #define HANDLE_CB_GETEXTENDEDUI(hwnd, wParam, lParam, fn) \
963 (LRESULT)(INT_PTR)(BOOL)(fn)((hwnd))
964
965 /* BOOL ComboBox_OnGetDroppedState(HWND hwnd) */
966 #define HANDLE_CB_GETDROPPEDSTATE(hwnd, wParam, lParam, fn) \
967 (LRESULT)(INT_PTR)(BOOL)(fn)((hwnd))
968
969 /* INT ComboBox_OnFindStringExact(HWND hwnd, INT indexStart, LPCTSTR lpszFind) */
970 #define HANDLE_CB_FINDSTRINGEXACT(hwnd, wParam, lParam, fn) \
971 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (LPCTSTR)(lParam))
972
973 /* LCID ComboBox_OnSetLocale(HWND hwnd, LCID wLocaleID) */
974 #define HANDLE_CB_SETLOCALE(hwnd, wParam, lParam, fn) \
975 (LRESULT)(LCID)(fn)((hwnd), (LCID)(wParam))
976
977 /* LCID ComboBox_OnGetLocale(HWND hwnd) */
978 #define HANDLE_CB_GETLOCALE(hwnd, wParam, lParam, fn) \
979 (LRESULT)(LCID)(fn)((hwnd))
980
981 /* INT ComboBox_OnGetTopIndex(HWND hwnd) */
982 #define HANDLE_CB_GETTOPINDEX(hwnd, wParam, lParam, fn) \
983 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
984
985 /* INT ComboBox_OnSetTopIndex(HWND hwnd, INT index) */
986 #define HANDLE_CB_SETTOPINDEX(hwnd, wParam, lParam, fn) \
987 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
988
989 /* INT ComboBox_OnGetHorizontalExtent(HWND hwnd) */
990 #define HANDLE_CB_GETHORIZONTALEXTENT(hwnd, wParam, lParam, fn) \
991 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
992
993 /* void ComboBox_OnSetHorizontalExtent(HWND hwnd, INT cxExtent) */
994 #define HANDLE_CB_SETHORIZONTALEXTENT(hwnd, wParam, lParam, fn) \
995 ((fn)((hwnd), (INT)(wParam)), 0L)
996
997 /* INT ComboBox_OnGetDroppedWidth(HWND hwnd) */
998 #define HANDLE_CB_GETDROPPEDWIDTH(hwnd, wParam, lParam, fn) \
999 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
1000
1001 /* INT ComboBox_OnSetDroppedWidth(HWND hwnd, INT wWidth) */
1002 #define HANDLE_CB_SETDROPPEDWIDTH(hwnd, wParam, lParam, fn) \
1003 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam))
1004
1005 /* INT ComboBox_OnInitStorage(HWND hwnd, INT cItems, DWORD cb) */
1006 #define HANDLE_CB_INITSTORAGE(hwnd, wParam, lParam, fn) \
1007 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (DWORD)(lParam))
1008
1009 // TODO: CB_MULTIPLEADDSTRING and CB_GETCOMBOBOXINFO
1010
1011 /* INT ScrollBar_OnSetPos(HWND hwnd, INT nPos, BOOL fRedraw) */
1012 #define HANDLE_SBM_SETPOS(hwnd, wParam, lParam, fn) \
1013 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (BOOL)(lParam))
1014
1015 /* INT ScrollBar_OnGetPos(HWND hwnd) */
1016 #define HANDLE_SBM_GETPOS(hwnd, wParam, lParam, fn) \
1017 (LRESULT)(INT_PTR)(INT)(fn)((hwnd))
1018
1019 /* INT ScrollBar_OnSetRange(HWND hwnd, INT nMinPos, INT nMaxPos) */
1020 #define HANDLE_SBM_SETRANGE(hwnd, wParam, lParam, fn) \
1021 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1022
1023 /* INT ScrollBar_OnSetRangeRedraw(HWND hwnd, INT nMinPos, INT nMaxPos) */
1024 #define HANDLE_SBM_SETRANGEREDRAW(hwnd, wParam, lParam, fn) \
1025 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1026
1027 /* void ScrollBar_OnGetRange(HWND hwnd, LPINT lpnMinPos, LPINT lpnMaxPos) */
1028 #define HANDLE_SBM_GETRANGE(hwnd, wParam, lParam, fn) \
1029 ((fn)((hwnd), (LPINT)(wParam), (LPINT)(lParam)), 0L)
1030
1031 /* BOOL ScrollBar_OnEnableArrows(HWND hwnd, UINT fuArrowFlags) */
1032 #define HANDLE_SBM_ENABLE_ARROWS(hwnd, wParam, lParam, fn) \
1033 (LRESULT)(INT_PTR)(BOOL)(fn)((hwnd), (UINT)(wParam))
1034
1035 /* INT ScrollBar_OnSetScrollInfo(HWND hwnd, BOOL fRedraw, LPSCROLLINFO lpsi) */
1036 #define HANDLE_SBM_SETSCROLLINFO(hwnd, wParam, lParam, fn) \
1037 (LRESULT)(INT_PTR)(INT)(fn)((hwnd), (BOOL)(wParam), (LPSCROLLINFO)(lParam))
1038
1039 /* BOOL ScrollBar_OnGetScrollInfo(HWND hwnd, LPSCROLLINFO lpsi) */
1040 #define HANDLE_SBM_GETSCROLLINFO(hwnd, wParam, lParam, fn) \
1041 (LRESULT)(INT_PTR)(BOOL)(fn)((hwnd), (LPSCROLLINFO)(lParam))
1042
1043 /* BOOL ScrollBar_OnGetScrollBarInfo(HWND hwnd, LPSCROLLBARINFO lpsbi) */
1044 #define HANDLE_SBM_GETSCROLLBARINFO(hwnd, wParam, lParam, fn) \
1045 (LRESULT)(INT_PTR)(BOOL)(fn)((hwnd), (LPSCROLLBARINFO)(lParam))
1046
1047 #ifdef _UNDOCUSER_H /* UNDOCUMENTED */
1048 /* LRESULT Cls_OnDropObject(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1049 #ifndef HANDLE_WM_DROPOBJECT
1050 #define HANDLE_WM_DROPOBJECT(hwnd, wParam, lParam, fn) \
1051 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1052 #define FORWARD_WM_DROPOBJECT(hwnd, wParam, lParam, fn) \
1053 (LRESULT)((fn)((hwnd), WM_DROPOBJECT, wParam, lParam))
1054 #endif
1055
1056 /* LRESULT Cls_OnQueryDropObject(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1057 #ifndef HANDLE_WM_QUERYDROPOBJECT
1058 #define HANDLE_WM_QUERYDROPOBJECT(hwnd, wParam, lParam, fn) \
1059 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1060 #define FORWARD_WM_QUERYDROPOBJECT(hwnd, wParam, lParam, fn) \
1061 (LRESULT)((fn)((hwnd), WM_QUERYDROPOBJECT, wParam, lParam))
1062 #endif
1063
1064 /* LRESULT Cls_OnBeginDrag(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1065 #ifndef HANDLE_WM_BEGINDRAG
1066 #define HANDLE_WM_BEGINDRAG(hwnd, wParam, lParam, fn) \
1067 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1068 #define FORWARD_WM_BEGINDRAG(hwnd, wParam, lParam, fn) \
1069 (LRESULT)((fn)((hwnd), WM_BEGINDRAG, wParam, lParam))
1070 #endif
1071
1072 /* LRESULT Cls_OnDragLoop(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1073 #ifndef HANDLE_WM_DRAGLOOP
1074 #define HANDLE_WM_DRAGLOOP(hwnd, wParam, lParam, fn) \
1075 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1076 #define FORWARD_WM_DRAGLOOP(hwnd, wParam, lParam, fn) \
1077 (LRESULT)((fn)((hwnd), WM_DRAGLOOP, wParam, lParam))
1078 #endif
1079
1080 /* LRESULT Cls_OnDragSelect(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1081 #ifndef HANDLE_WM_DRAGSELECT
1082 #define HANDLE_WM_DRAGSELECT(hwnd, wParam, lParam, fn) \
1083 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1084 #define FORWARD_WM_DRAGSELECT(hwnd, wParam, lParam, fn) \
1085 (LRESULT)((fn)((hwnd), WM_DRAGSELECT, wParam, lParam))
1086 #endif
1087
1088 /* LRESULT Cls_OnDragMove(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1089 #ifndef HANDLE_WM_DRAGMOVE
1090 #define HANDLE_WM_DRAGMOVE(hwnd, wParam, lParam, fn) \
1091 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1092 #define FORWARD_WM_DRAGMOVE(hwnd, wParam, lParam, fn) \
1093 (LRESULT)((fn)((hwnd), WM_DRAGMOVE, wParam, lParam))
1094 #endif
1095 #endif
1096
1097 #endif