[SDK][INCLUDE] Update msgdump.h and winxx.h (TreeView and ListView support)
[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 6 /* Version 6 */
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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 ((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 /* COLORREF ListView_OnGetBkColor(HWND hwnd) */
1048 #define HANDLE_LVM_GETBKCOLOR(hwnd, wParam, lParam, fn) \
1049 (COLORREF)(fn)((hwnd))
1050
1051 /* BOOL ListView_OnSetBkColor(HWND hwnd, COLORREF clrBk) */
1052 #define HANDLE_LVM_SETBKCOLOR(hwnd, wParam, lParam, fn) \
1053 (BOOL)(fn)((hwnd), (COLORREF)(wParam))
1054
1055 /* HIMAGELIST ListView_OnGetImageList(HWND hwnd, INT iImageList) */
1056 #define HANDLE_LVM_GETIMAGELIST(hwnd, wParam, lParam, fn) \
1057 (LRESULT)(HIMAGELIST)(fn)((hwnd), (INT)(wParam))
1058
1059 /* HIMAGELIST ListView_OnSetImageList(HWND hwnd, INT iImageList, HIMAGELIST himl) */
1060 #define HANDLE_LVM_SETIMAGELIST(hwnd, wParam, lParam, fn) \
1061 (LRESULT)(HIMAGELIST)(fn)((hwnd), (INT)(wParam), (HIMAGELIST)(lParam))
1062
1063 /* INT ListView_OnGetItemCount(HWND hwnd) */
1064 #define HANDLE_LVM_GETITEMCOUNT(hwnd, wParam, lParam, fn) \
1065 (INT)(fn)((hwnd))
1066
1067 /* BOOL ListView_OnGetItemA(HWND hwnd, LV_ITEMA *pitem) */
1068 #define HANDLE_LVM_GETITEMA(hwnd, wParam, lParam, fn) \
1069 (BOOL)(fn)((hwnd), (LV_ITEMA *)(lParam))
1070
1071 /* BOOL ListView_OnSetItemA(HWND hwnd, const LV_ITEMA *pitem) */
1072 #define HANDLE_LVM_SETITEMA(hwnd, wParam, lParam, fn) \
1073 (BOOL)(fn)((hwnd), (const LV_ITEMA *)(lParam))
1074
1075 /* INT ListView_OnInsertItemA(HWND hwnd, const LV_ITEMA *pitem) */
1076 #define HANDLE_LVM_INSERTITEMA(hwnd, wParam, lParam, fn) \
1077 (INT)(fn)((hwnd), (const LV_ITEMA *)(lParam))
1078
1079 /* BOOL ListView_OnDeleteItem(HWND hwnd, INT i) */
1080 #define HANDLE_LVM_DELETEITEM(hwnd, wParam, lParam, fn) \
1081 (BOOL)(fn)((hwnd), (INT)(wParam))
1082
1083 /* BOOL ListView_OnDeleteAllItems(HWND hwnd) */
1084 #define HANDLE_LVM_DELETEALLITEMS(hwnd, wParam, lParam, fn) \
1085 (BOOL)(fn)((hwnd))
1086
1087 /* BOOL ListView_OnGetCallbackMask(HWND hwnd) */
1088 #define HANDLE_LVM_GETCALLBACKMASK(hwnd, wParam, lParam, fn) \
1089 (BOOL)(fn)((hwnd))
1090
1091 /* BOOL ListView_OnSetCallbackMask(HWND hwnd, UINT mask) */
1092 #define HANDLE_LVM_SETCALLBACKMASK(hwnd, wParam, lParam, fn) \
1093 (BOOL)(fn)((hwnd), (UINT)(wParam))
1094
1095 /* INT ListView_OnGetNextItem(HWND hwnd, INT i, UINT flags) */
1096 #define HANDLE_LVM_GETNEXTITEM(hwnd, wParam, lParam, fn) \
1097 (INT)(fn)((hwnd), (INT)(wParam), (UINT)(lParam))
1098
1099 /* INT ListView_OnFindItemA(HWND hwnd, INT iStart, const LV_FINDINFOA *plvfi) */
1100 #define HANDLE_LVM_FINDITEMA(hwnd, wParam, lParam, fn) \
1101 (INT)(fn)((hwnd), (INT)(wParam), (const LV_FINDINFOA *)(lParam))
1102
1103 /* BOOL ListView_OnGetItemRect(HWND hwnd, INT i, RECT *prc) */
1104 #define HANDLE_LVM_GETITEMRECT(hwnd, wParam, lParam, fn) \
1105 (BOOL)(fn)((hwnd), (INT)(wParam), (RECT *)(lParam))
1106
1107 /* BOOL ListView_OnSetItemPosition(HWND hwnd, INT i, INT x, INT y) */
1108 #define HANDLE_LVM_SETITEMPOSITION(hwnd, wParam, lParam, fn) \
1109 (BOOL)(fn)((hwnd), (INT)(wParam), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
1110
1111 /* BOOL ListView_OnGetItemPosition(HWND hwnd, INT i, POINT *ppt) */
1112 #define HANDLE_LVM_GETITEMPOSITION(hwnd, wParam, lParam, fn) \
1113 (BOOL)(fn)((hwnd), (INT)(wParam), (POINT *)(lParam))
1114
1115 /* INT ListView_OnGetStringWidthA(HWND hwnd, LPCSTR psz) */
1116 #define HANDLE_LVM_GETSTRINGWIDTHA(hwnd, wParam, lParam, fn) \
1117 (INT)(fn)((hwnd), (LPCSTR)(lParam))
1118
1119 /* INT ListView_OnHitTest(HWND hwnd, LV_HITTESTINFO *pinfo) */
1120 #define HANDLE_LVM_HITTEST(hwnd, wParam, lParam, fn) \
1121 (INT)(fn)((hwnd), (LV_HITTESTINFO *)(lParam))
1122
1123 /* BOOL ListView_OnEnsureVisible(HWND hwnd, INT i, BOOL fPartialOK) */
1124 #define HANDLE_LVM_ENSUREVISIBLE(hwnd, wParam, lParam, fn) \
1125 (BOOL)(fn)((hwnd), (INT)(wParam), (BOOL)(lParam))
1126
1127 /* BOOL ListView_OnScroll(HWND hwnd, INT dx, INT dy) */
1128 #define HANDLE_LVM_SCROLL(hwnd, wParam, lParam, fn) \
1129 (BOOL)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1130
1131 /* BOOL ListView_OnRedrawItems(HWND hwnd, INT iFirst, INT iLast) */
1132 #define HANDLE_LVM_REDRAWITEMS(hwnd, wParam, lParam, fn) \
1133 (BOOL)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1134
1135 /* BOOL ListView_OnArrange(HWND hwnd, UINT code) */
1136 #define HANDLE_LVM_ARRANGE(hwnd, wParam, lParam, fn) \
1137 (BOOL)(fn)((hwnd), (UINT)(wParam))
1138
1139 /* HWND ListView_OnEditLabelA(HWND hwnd, INT i) */
1140 #define HANDLE_LVM_EDITLABELA(hwnd, wParam, lParam, fn) \
1141 (LRESULT)(HWND)(fn)((hwnd), (INT)(wParam))
1142
1143 /* HWND ListView_OnGetEditControl(HWND hwnd) */
1144 #define HANDLE_LVM_GETEDITCONTROL(hwnd, wParam, lParam, fn) \
1145 (LRESULT)(HWND)(fn)((hwnd))
1146
1147 /* BOOL ListView_OnGetColumnA(HWND hwnd, INT iCol, LV_COLUMNA *pcol) */
1148 #define HANDLE_LVM_GETCOLUMNA(hwnd, wParam, lParam, fn) \
1149 (BOOL)(fn)((hwnd), (INT)(wParam), (LV_COLUMNA *)(lParam))
1150
1151 /* BOOL ListView_OnSetColumnA(HWND hwnd, INT iCol, const LV_COLUMNA *pcol) */
1152 #define HANDLE_LVM_SETCOLUMNA(hwnd, wParam, lParam, fn) \
1153 (BOOL)(fn)((hwnd), (INT)(wParam), (const LV_COLUMNA *)(lParam))
1154
1155 /* INT ListView_OnInsertColumnA(HWND hwnd, INT iCol, const LV_COLUMNA *pcol) */
1156 #define HANDLE_LVM_INSERTCOLUMNA(hwnd, wParam, lParam, fn) \
1157 (INT)(fn)((hwnd), (INT)(wParam), (const LV_COLUMNA *)(lParam))
1158
1159 /* BOOL ListView_OnDeleteColumn(HWND hwnd, INT iCol) */
1160 #define HANDLE_LVM_DELETECOLUMN(hwnd, wParam, lParam, fn) \
1161 (BOOL)(fn)((hwnd), (INT)(wParam))
1162
1163 /* INT ListView_OnGetColumnWidth(HWND hwnd, INT iCol) */
1164 #define HANDLE_LVM_GETCOLUMNWIDTH(hwnd, wParam, lParam, fn) \
1165 (INT)(fn)((hwnd), (INT)(wParam))
1166
1167 /* BOOL ListView_OnSetColumnWidth(HWND hwnd, INT iCol, INT cx) */
1168 #define HANDLE_LVM_SETCOLUMNWIDTH(hwnd, wParam, lParam, fn) \
1169 (BOOL)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1170
1171 /* HWND ListView_OnGetHeader(HWND hwnd) */
1172 #define HANDLE_LVM_GETHEADER(hwnd, wParam, lParam, fn) \
1173 (LRESULT)(HWND)(fn)((hwnd))
1174
1175 /* HIMAGELIST ListView_OnCreateDragImage(HWND hwnd, INT i, LPPOINT lpptUpLeft) */
1176 #define HANDLE_LVM_CREATEDRAGIMAGE(hwnd, wParam, lParam, fn) \
1177 (LRESULT)(HIMAGELIST)(fn)((hwnd), (INT)(wParam), (LPPOINT)(lParam))
1178
1179 /* BOOL ListView_OnGetViewRect(HWND hwnd, RECT *prc) */
1180 #define HANDLE_LVM_GETVIEWRECT(hwnd, wParam, lParam, fn) \
1181 (BOOL)(fn)((hwnd), (RECT *)(lParam))
1182
1183 /* COLORREF ListView_OnGetTextColor(HWND hwnd) */
1184 #define HANDLE_LVM_GETTEXTCOLOR(hwnd, wParam, lParam, fn) \
1185 (COLORREF)(fn)((hwnd))
1186
1187 /* BOOL ListView_OnSetTextColor(HWND hwnd, COLORREF clrText) */
1188 #define HANDLE_LVM_SETTEXTCOLOR(hwnd, wParam, lParam, fn) \
1189 (BOOL)(fn)((hwnd), (COLORREF)(lParam))
1190
1191 /* COLORREF ListView_OnGetTextBkColor(HWND hwnd) */
1192 #define HANDLE_LVM_GETTEXTBKCOLOR(hwnd, wParam, lParam, fn) \
1193 (COLORREF)(fn)((hwnd))
1194
1195 /* BOOL ListView_OnSetTextBkColor(HWND hwnd, COLORREF clrTextBk) */
1196 #define HANDLE_LVM_SETTEXTBKCOLOR(hwnd, wParam, lParam, fn) \
1197 (BOOL)(fn)((hwnd), (COLORREF)(lParam))
1198
1199 /* INT ListView_OnGetTopIndex(HWND hwnd) */
1200 #define HANDLE_LVM_GETTOPINDEX(hwnd, wParam, lParam, fn) \
1201 (INT)(fn)((hwnd))
1202
1203 /* INT ListView_OnGetCountPerPage(HWND hwnd) */
1204 #define HANDLE_LVM_GETCOUNTPERPAGE(hwnd, wParam, lParam, fn) \
1205 (INT)(fn)((hwnd))
1206
1207 /* BOOL ListView_OnGetOrigin(HWND hwnd, POINT *ppt) */
1208 #define HANDLE_LVM_GETORIGIN(hwnd, wParam, lParam, fn) \
1209 (BOOL)(fn)((hwnd), (POINT *)(lParam))
1210
1211 /* BOOL ListView_OnUpdate(HWND hwnd, INT i) */
1212 #define HANDLE_LVM_UPDATE(hwnd, wParam, lParam, fn) \
1213 (BOOL)(fn)((hwnd), (INT)(wParam))
1214
1215 /* BOOL ListView_OnSetItemState(HWND hwnd, INT i, LV_ITEM *lvi) */
1216 #define HANDLE_LVM_SETITEMSTATE(hwnd, wParam, lParam, fn) \
1217 (BOOL)(fn)((hwnd), (INT)(wParam), (LV_ITEM *)(lParam))
1218
1219 /* UINT ListView_OnGetItemState(HWND hwnd, INT i, UINT mask) */
1220 #define HANDLE_LVM_GETITEMSTATE(hwnd, wParam, lParam, fn) \
1221 (UINT)(fn)((hwnd), (INT)(wParam), (UINT)(lParam))
1222
1223 /* INT ListView_OnGetItemTextA(HWND hwnd, INT i, LV_ITEMA *lvi) */
1224 #define HANDLE_LVM_GETITEMTEXTA(hwnd, wParam, lParam, fn) \
1225 (INT)(fn)((hwnd), (INT)(wParam), (LV_ITEMA *)(lParam))
1226
1227 /* BOOL ListView_OnSetItemTextA(HWND hwnd, INT i, const LV_ITEMA *lvi) */
1228 #define HANDLE_LVM_SETITEMTEXTA(hwnd, wParam, lParam, fn) \
1229 (BOOL)(fn)((hwnd), (INT)(wParam), (const LV_ITEMA *)(lParam))
1230
1231 /* void ListView_OnSetItemCount(HWND hwnd, INT cItems) */
1232 #define HANDLE_LVM_SETITEMCOUNT(hwnd, wParam, lParam, fn) \
1233 ((fn)((hwnd), (INT)(wParam)), 0L)
1234
1235 /* BOOL ListView_OnSortItems(HWND hwnd, LPARAM lPrm, PFNLVCOMPARE pfnCompare) */
1236 #define HANDLE_LVM_SORTITEMS(hwnd, wParam, lParam, fn) \
1237 (BOOL)(fn)((hwnd), (LPARAM)(wParam), (PFNLVCOMPARE)(lParam))
1238
1239 /* void ListView_OnSetItemPosition32(HWND hwnd, INT i, const POINT *ppt) */
1240 #define HANDLE_LVM_SETITEMPOSITION32(hwnd, wParam, lParam, fn) \
1241 ((fn)((hwnd), (INT)(wParam), (const POINT *)(lParam)), 0L)
1242
1243 /* UINT ListView_OnGetSelectedCount(HWND hwnd) */
1244 #define HANDLE_LVM_GETSELECTEDCOUNT(hwnd, wParam, lParam, fn) \
1245 (UINT)(fn)((hwnd))
1246
1247 /* DWORD ListView_OnGetItemSpacing(HWND hwnd, BOOL fSmall) */
1248 #define HANDLE_LVM_GETITEMSPACING(hwnd, wParam, lParam, fn) \
1249 (DWORD)(fn)((hwnd), (BOOL)(wParam))
1250
1251 /* BOOL ListView_OnGetISearchStringA(HWND hwnd, LPSTR lpsz) */
1252 #define HANDLE_LVM_GETISEARCHSTRINGA(hwnd, wParam, lParam, fn) \
1253 (BOOL)(fn)((hwnd), (LPSTR)(lParam))
1254
1255 /* DWORD ListView_OnSetIconSpacing(HWND hwnd, INT cx, INT cy) */
1256 #define HANDLE_LVM_SETICONSPACING(hwnd, wParam, lParam, fn) \
1257 (DWORD)(fn)((hwnd), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
1258
1259 /* DWORD ListView_OnSetExtendedListViewStyle(HWND hwnd, DWORD dwMask, DWORD dw) */
1260 #define HANDLE_LVM_SETEXTENDEDLISTVIEWSTYLE(hwnd, wParam, lParam, fn) \
1261 (DWORD)(fn)((hwnd), (DWORD)(wParam), (DWORD)(lParam))
1262
1263 /* DWORD ListView_OnGetExtendedListViewStyle(HWND hwnd) */
1264 #define HANDLE_LVM_GETEXTENDEDLISTVIEWSTYLE(hwnd, wParam, lParam, fn) \
1265 (DWORD)(fn)((hwnd))
1266
1267 /* BOOL ListView_OnGetSubItemRect(HWND hwnd, INT iItem, RECT *prc) */
1268 #define HANDLE_LVM_GETSUBITEMRECT(hwnd, wParam, lParam, fn) \
1269 (BOOL)(fn)((hwnd), (INT)(wParam), (RECT *)(lParam))
1270
1271 /* INT ListView_OnSubItemHitTest(HWND hwnd, WPARAM wParam, LPLVHITTESTINFO plvhti) */
1272 #define HANDLE_LVM_SUBITEMHITTEST(hwnd, wParam, lParam, fn) \
1273 (INT)(fn)((hwnd), (wParam), (LPLVHITTESTINFO)(lParam))
1274
1275 /* BOOL ListView_OnSetColumnOrderArray(HWND hwnd, INT iCount, LPINT pi) */
1276 #define HANDLE_LVM_SETCOLUMNORDERARRAY(hwnd, wParam, lParam, fn) \
1277 (BOOL)(fn)((hwnd), (INT)(wParam), (LPINT)(lParam))
1278
1279 /* BOOL ListView_OnGetColumnOrderArray(HWND hwnd, INT iCount, LPINT pi) */
1280 #define HANDLE_LVM_GETCOLUMNORDERARRAY(hwnd, wParam, lParam, fn) \
1281 (BOOL)(fn)((hwnd), (INT)(wParam), (LPINT)(lParam))
1282
1283 /* INT ListView_OnSetHotItem(HWND hwnd, INT i) */
1284 #define HANDLE_LVM_SETHOTITEM(hwnd, wParam, lParam, fn) \
1285 (INT)(fn)((hwnd), (INT)(wParam))
1286
1287 /* INT ListView_OnGetHotItem(HWND hwnd) */
1288 #define HANDLE_LVM_GETHOTITEM(hwnd, wParam, lParam, fn) \
1289 (INT)(fn)((hwnd))
1290
1291 /* HCURSOR ListView_OnSetHotCursor(HWND hwnd, HCURSOR hcur) */
1292 #define HANDLE_LVM_SETHOTCURSOR(hwnd, wParam, lParam, fn) \
1293 (LRESULT)(HCURSOR)(fn)((hwnd), (HCURSOR)(lParam))
1294
1295 /* HCURSOR ListView_OnGetHotCursor(HWND hwnd) */
1296 #define HANDLE_LVM_GETHOTCURSOR(hwnd, wParam, lParam, fn) \
1297 (LRESULT)(HCURSOR)(fn)((hwnd))
1298
1299 /* DWORD ListView_OnApproximateViewRect(HWND hwnd, INT iWidth, INT iHeight, INT iCount) */
1300 #define HANDLE_LVM_APPROXIMATEVIEWRECT(hwnd, wParam, lParam, fn) \
1301 (DWORD)(fn)((hwnd), (INT)(wParam), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
1302
1303 /* BOOL ListView_OnSetWorkAreas(HWND hwnd, INT nWorkAreas, const RECT *prc) */
1304 #define HANDLE_LVM_SETWORKAREAS(hwnd, wParam, lParam, fn) \
1305 (BOOL)(fn)((hwnd), (INT)(wParam), (const RECT *)(lParam))
1306
1307 /* INT ListView_OnGetSelectionMark(HWND hwnd) */
1308 #define HANDLE_LVM_GETSELECTIONMARK(hwnd, wParam, lParam, fn) \
1309 (INT)(fn)((hwnd))
1310
1311 /* INT ListView_OnSetSelectionMark(HWND hwnd, INT i) */
1312 #define HANDLE_LVM_SETSELECTIONMARK(hwnd, wParam, lParam, fn) \
1313 (INT)(fn)((hwnd), (INT)(lParam))
1314
1315 /* BOOL ListView_OnSetBkImageA(HWND hwnd, const LVBKIMAGEA *plvbki) */
1316 #define HANDLE_LVM_SETBKIMAGEA(hwnd, wParam, lParam, fn) \
1317 (BOOL)(fn)((hwnd), (const LVBKIMAGEA *)(lParam))
1318
1319 /* BOOL ListView_OnGetBkImageA(HWND hwnd, LVBKIMAGEA *plvbki) */
1320 #define HANDLE_LVM_GETBKIMAGEA(hwnd, wParam, lParam, fn) \
1321 (BOOL)(fn)((hwnd), (LVBKIMAGEA *)(lParam))
1322
1323 /* BOOL ListView_OnGetWorkAreas(HWND hwnd, INT nWorkAreas, RECT *prc) */
1324 #define HANDLE_LVM_GETWORKAREAS(hwnd, wParam, lParam, fn) \
1325 (BOOL)(fn)((hwnd), (INT)(wParam), (RECT *)(lParam))
1326
1327 /* DWORD ListView_OnSetHoverTime(HWND hwnd, DWORD dwHoverTimeMs) */
1328 #define HANDLE_LVM_SETHOVERTIME(hwnd, wParam, lParam, fn) \
1329 (DWORD)(fn)((hwnd), (DWORD)(lParam))
1330
1331 /* DWORD ListView_OnGetHoverTime(HWND hwnd) */
1332 #define HANDLE_LVM_GETHOVERTIME(hwnd, wParam, lParam, fn) \
1333 (DWORD)(fn)((hwnd))
1334
1335 /* BOOL ListView_OnGetNumberOfWorkAreas(HWND hwnd, UINT *pnWorkAreas) */
1336 #define HANDLE_LVM_GETNUMBEROFWORKAREAS(hwnd, wParam, lParam, fn) \
1337 (BOOL)(fn)((hwnd), (UINT *)(lParam))
1338
1339 /* HWND ListView_OnSetToolTips(HWND hwnd, HWND hwndNewHwnd) */
1340 #define HANDLE_LVM_SETTOOLTIPS(hwnd, wParam, lParam, fn) \
1341 (LRESULT)(HWND)(fn)((hwnd), (HWND)(wParam))
1342
1343 /* BOOL ListView_OnGetItemW(HWND hwnd, LV_ITEMW *pitem) */
1344 #define HANDLE_LVM_GETITEMW(hwnd, wParam, lParam, fn) \
1345 (BOOL)(fn)((hwnd), (LV_ITEMW *)(lParam))
1346
1347 /* BOOL ListView_OnSetItemW(HWND hwnd, const LV_ITEMW *pitem) */
1348 #define HANDLE_LVM_SETITEMW(hwnd, wParam, lParam, fn) \
1349 (BOOL)(fn)((hwnd), (const LV_ITEMW *)(lParam))
1350
1351 /* INT ListView_OnInsertItemW(HWND hwnd, const LV_ITEMW *pitem) */
1352 #define HANDLE_LVM_INSERTITEMW(hwnd, wParam, lParam, fn) \
1353 (INT)(fn)((hwnd), (const LV_ITEMW *)(lParam))
1354
1355 /* HWND ListView_OnGetToolTips(HWND hwnd) */
1356 #define HANDLE_LVM_GETTOOLTIPS(hwnd, wParam, lParam, fn) \
1357 (LRESULT)(HWND)(fn)((hwnd))
1358
1359 /* BOOL ListView_OnSortItemsEx(HWND hwnd, PFNLVCOMPARE pfnCompare, LPARAM lPrm) */
1360 #define HANDLE_LVM_SORTITEMSEX(hwnd, wParam, lParam, fn) \
1361 (BOOL)(fn)((hwnd), (PFNLVCOMPARE)(lParam), (LPARAM)(wParam))
1362
1363 /* INT ListView_OnFindItemW(HWND hwnd, INT iStart, const LV_FINDINFOW *plvfi) */
1364 #define HANDLE_LVM_FINDITEMW(hwnd, wParam, lParam, fn) \
1365 (INT)(fn)((hwnd), (INT)(wParam), (const LV_FINDINFOW *)(lParam))
1366
1367 /* INT ListView_OnGetStringWidthW(HWND hwnd, LPCWSTR psz) */
1368 #define HANDLE_LVM_GETSTRINGWIDTHW(hwnd, wParam, lParam, fn) \
1369 (INT)(fn)((hwnd), (LPCWSTR)(lParam))
1370
1371 #if NTDDI_VERSION >= 0x06000000
1372 /* UINT ListView_OnGetGroupState(HWND hwnd, DWORD dwGroupId, DWORD dwMask) */
1373 #define HANDLE_LVM_GETGROUPSTATE(hwnd, wParam, lParam, fn) \
1374 (UINT)(fn)((hwnd), (DWORD)(wParam), (DWORD)(lParam))
1375
1376 /* INT ListView_OnGetFocusedGroup(HWND hwnd) */
1377 #define HANDLE_LVM_GETFOCUSEDGROUP(hwnd, wParam, lParam, fn) \
1378 (INT)(fn)((hwnd))
1379 #endif
1380
1381 /* INT ListView_OnGetColumnW(HWND hwnd, INT iCol) */
1382 #define HANDLE_LVM_GETCOLUMNW(hwnd, wParam, lParam, fn) \
1383 (INT)(fn)((hwnd), (INT)(wParam))
1384
1385 /* BOOL ListView_OnSetColumnW(HWND hwnd, INT iCol, INT cx) */
1386 #define HANDLE_LVM_SETCOLUMNW(hwnd, wParam, lParam, fn) \
1387 (BOOL)(fn)((hwnd), (INT)(wParam), (INT)(lParam))
1388
1389 /* INT ListView_OnInsertColumnW(HWND hwnd, INT iCol, const LV_COLUMNW *pcol) */
1390 #define HANDLE_LVM_INSERTCOLUMNW(hwnd, wParam, lParam, fn) \
1391 (INT)(fn)((hwnd), (INT)(wParam), (const LV_COLUMNW *)(lParam))
1392
1393 #if NTDDI_VERSION >= 0x06000000
1394 /* BOOL ListView_OnGetGroupRect(HWND hwnd, INT iGroupId, RECT *prc) */
1395 #define HANDLE_LVM_GETGROUPRECT(hwnd, wParam, lParam, fn) \
1396 (BOOL)(fn)((hwnd), (INT)(wParam), (RECT *)(lParam))
1397 #endif
1398
1399 /* INT ListView_OnGetItemTextW(HWND hwnd, INT i, LV_ITEMW *pitem) */
1400 #define HANDLE_LVM_GETITEMTEXTW(hwnd, wParam, lParam, fn) \
1401 (INT)(fn)((hwnd), (INT)(wParam), (LV_ITEMW *)(lParam))
1402
1403 /* INT ListView_OnSetItemTextW(HWND hwnd, INT i, const LV_ITEMW *pitem) */
1404 #define HANDLE_LVM_SETITEMTEXTW(hwnd, wParam, lParam, fn) \
1405 (INT)(fn)((hwnd), (INT)(wParam), (const LV_ITEMW *)(lParam))
1406
1407 /* BOOL ListView_OnGetISearchStringW(HWND hwnd, LPWSTR lpsz) */
1408 #define HANDLE_LVM_GETISEARCHSTRINGW(hwnd, wParam, lParam, fn) \
1409 (BOOL)(fn)((hwnd), (LPWSTR)(lParam))
1410
1411 /* HWND ListView_OnEditLabelW(HWND hwnd, INT i) */
1412 #define HANDLE_LVM_EDITLABELW(hwnd, wParam, lParam, fn) \
1413 (LRESULT)(HWND)(fn)((hwnd), (INT)(wParam))
1414
1415 /* BOOL ListView_OnSetBkImageW(HWND hwnd, const LVBKIMAGEW *plvbki) */
1416 #define HANDLE_LVM_SETBKIMAGEW(hwnd, wParam, lParam, fn) \
1417 (BOOL)(fn)((hwnd), (const LVBKIMAGEW *)(lParam))
1418
1419 /* BOOL ListView_OnGetBkImageW(HWND hwnd, LVBKIMAGEW *plvbki) */
1420 #define HANDLE_LVM_GETBKIMAGEW(hwnd, wParam, lParam, fn) \
1421 (BOOL)(fn)((hwnd), (LVBKIMAGEW *)(lParam))
1422
1423 /* void ListView_OnSetSelectedColumn(HWND hwnd, INT iCol) */
1424 #define HANDLE_LVM_SETSELECTEDCOLUMN(hwnd, wParam, lParam, fn) \
1425 ((fn)((hwnd), (INT)(wParam)), 0L)
1426
1427 /* LRESULT ListView_OnSetTileWidth(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1428 #define HANDLE_LVM_SETTILEWIDTH(hwnd, wParam, lParam, fn) \
1429 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1430
1431 /* DWORD ListView_OnSetView(HWND hwnd, DWORD iView) */
1432 #define HANDLE_LVM_SETVIEW(hwnd, wParam, lParam, fn) \
1433 (DWORD)(fn)((hwnd), (DWORD)(wParam))
1434
1435 /* DWORD ListView_OnGetView(HWND hwnd) */
1436 #define HANDLE_LVM_GETVIEW(hwnd, wParam, lParam, fn) \
1437 (DWORD)(fn)((hwnd))
1438
1439 #if NTDDI_VERSION >= 0x06000000
1440 /* INT ListView_OnInsertGroup(HWND hwnd, INT iGroupId, const LVGROUP *pGroup) */
1441 #define HANDLE_LVM_INSERTGROUP(hwnd, wParam, lParam, fn) \
1442 (INT)(fn)((hwnd), (INT)(wParam), (const LVGROUP *)(lParam))
1443
1444 /* INT ListView_OnSetGroupInfo(HWND hwnd, INT iGroupId, const LVGROUP *pGroup) */
1445 #define HANDLE_LVM_SETGROUPINFO(hwnd, wParam, lParam, fn) \
1446 (INT)(fn)((hwnd), (INT)(wParam), (const LVGROUP *)(lParam))
1447
1448 /* INT ListView_OnGetGroupInfo(HWND hwnd, INT iGroupId, LVGROUP *pGroup) */
1449 #define HANDLE_LVM_GETGROUPINFO(hwnd, wParam, lParam, fn) \
1450 (INT)(fn)((hwnd), (INT)(wParam), (LVGROUP *)(lParam))
1451
1452 /* INT ListView_OnRemoveGroup(HWND hwnd, INT iGroupId) */
1453 #define HANDLE_LVM_REMOVEGROUP(hwnd, wParam, lParam, fn) \
1454 (INT)(fn)((hwnd), (INT)(wParam))
1455
1456 /* LRESULT ListView_OnMoveGroup(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1457 #define HANDLE_LVM_MOVEGROUP(hwnd, wParam, lParam, fn) \
1458 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1459
1460 /* INT ListView_OnGetGroupCount(HWND hwnd) */
1461 #define HANDLE_LVM_GETGROUPCOUNT(hwnd, wParam, lParam, fn) \
1462 (INT)(fn)((hwnd))
1463
1464 /* BOOL ListView_OnGetGroupInfoByIndex(HWND hwnd, INT iIndex, LVGROUP *pgrp) */
1465 #define HANDLE_LVM_GETGROUPINFOBYINDEX(hwnd, wParam, lParam, fn) \
1466 (BOOL)(fn)((hwnd), (INT)(wParam), (LVGROUP *)(lParam))
1467
1468 /* LRESULT ListView_OnMoveItemToGroup(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1469 #define HANDLE_LVM_MOVEITEMTOGROUP(hwnd, wParam, lParam, fn) \
1470 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1471
1472 /* void ListView_OnSetGroupMetrics(HWND hwnd, const LVGROUPMETRICS *pGroupMetrics) */
1473 #define HANDLE_LVM_SETGROUPMETRICS(hwnd, wParam, lParam, fn) \
1474 ((fn)((hwnd), (const LVGROUPMETRICS *)(lParam)), 0L)
1475
1476 /* void ListView_OnGetGroupMetrics(HWND hwnd, LVGROUPMETRICS *pGroupMetrics) */
1477 #define HANDLE_LVM_GETGROUPMETRICS(hwnd, wParam, lParam, fn) \
1478 ((fn)((hwnd), (LVGROUPMETRICS *)(lParam)), 0L)
1479
1480 /* INT ListView_OnEnableGroupView(HWND hwnd, BOOL fEnable) */
1481 #define HANDLE_LVM_ENABLEGROUPVIEW(hwnd, wParam, lParam, fn) \
1482 (INT)(fn)((hwnd), (BOOL)(wParam))
1483
1484 /* BOOL ListView_OnSortGroups(HWND hwnd, PFNLVGROUPCOMPARE pfnGroupCompate, void *plv) */
1485 #define HANDLE_LVM_SORTGROUPS(hwnd, wParam, lParam, fn) \
1486 (BOOL)(fn)((hwnd), (PFNLVGROUPCOMPARE)(wParam), (void *)(lParam))
1487
1488 /* void ListView_OnInsertGroupSorted(HWND hwnd, const LVINSERTGROUPSORTED *structInsert) */
1489 #define HANDLE_LVM_INSERTGROUPSORTED(hwnd, wParam, lParam, fn) \
1490 ((fn)((hwnd), (const LVINSERTGROUPSORTED *)(wParam)), 0L)
1491
1492 /* void ListView_OnRemoveAllGroups(HWND hwnd) */
1493 #define HANDLE_LVM_REMOVEALLGROUPS(hwnd, wParam, lParam, fn) \
1494 ((fn)((hwnd)), 0L)
1495
1496 /* BOOL ListView_OnHasGroup(HWND hwnd, DWORD dwGroupId) */
1497 #define HANDLE_LVM_HASGROUP(hwnd, wParam, lParam, fn) \
1498 (BOOL)(fn)((hwnd), (DWORD)(wParam))
1499 #endif
1500
1501 /* BOOL ListView_OnSetTileViewInfo(HWND hwnd, const LVTILEVIEWINFO *ptvi) */
1502 #define HANDLE_LVM_SETTILEVIEWINFO(hwnd, wParam, lParam, fn) \
1503 (BOOL)(fn)((hwnd), (const LVTILEVIEWINFO *)(lParam))
1504
1505 /* void ListView_OnGetTileViewInfo(HWND hwnd, LVTILEVIEWINFO *ptvi) */
1506 #define HANDLE_LVM_GETTILEVIEWINFO(hwnd, wParam, lParam, fn) \
1507 ((fn)((hwnd), (LVTILEVIEWINFO *)(lParam)), 0L)
1508
1509 /* BOOL ListView_OnSetTileInfo(HWND hwnd, const LVTILEINFO *pti) */
1510 #define HANDLE_LVM_SETTILEINFO(hwnd, wParam, lParam, fn) \
1511 (BOOL)(fn)((hwnd), (const LVTILEINFO *)(lParam))
1512
1513 /* void ListView_OnGetTileInfo(HWND hwnd, LVTILEINFO *pti) */
1514 #define HANDLE_LVM_GETTILEINFO(hwnd, wParam, lParam, fn) \
1515 ((fn)((hwnd), (LVTILEINFO *)(lParam)), 0L)
1516
1517 /* BOOL ListView_OnSetInsertMark(HWND hwnd, const LVINSERTMARK *lvim) */
1518 #define HANDLE_LVM_SETINSERTMARK(hwnd, wParam, lParam, fn) \
1519 (BOOL)(fn)((hwnd), (const LVINSERTMARK *)(lParam))
1520
1521 /* BOOL ListView_OnGetInsertMark(HWND hwnd, LVINSERTMARK *lvim) */
1522 #define HANDLE_LVM_GETINSERTMARK(hwnd, wParam, lParam, fn) \
1523 (BOOL)(fn)((hwnd), (LVINSERTMARK *)(lParam))
1524
1525 /* INT ListView_OnInsertMarkHitTest(HWND hwnd, LPPOINT point, LPLVINSERTMARK lvim) */
1526 #define HANDLE_LVM_INSERTMARKHITTEST(hwnd, wParam, lParam, fn) \
1527 (INT)(fn)((hwnd), (LPPOINT)(wParam), (LPLVINSERTMARK)(lParam))
1528
1529 /* INT ListView_OnGetInsertMarkRect(HWND hwnd, LPRECT rc) */
1530 #define HANDLE_LVM_GETINSERTMARKRECT(hwnd, wParam, lParam, fn) \
1531 (INT)(fn)((hwnd), (LPRECT)(lParam))
1532
1533 /* COLORREF ListView_OnSetInsertMarkColor(HWND hwnd, COLORREF color) */
1534 #define HANDLE_LVM_SETINSERTMARKCOLOR(hwnd, wParam, lParam, fn) \
1535 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1536
1537 /* COLORREF ListView_OnGetInsertMarkColor(HWND hwnd) */
1538 #define HANDLE_LVM_GETINSERTMARKCOLOR(hwnd, wParam, lParam, fn) \
1539 (COLORREF)(fn)((hwnd))
1540
1541 /* BOOL ListView_OnSetInfoTip(HWND hwnd, const LVSETINFOTIP *plvInfoTip) */
1542 #define HANDLE_LVM_SETINFOTIP(hwnd, wParam, lParam, fn) \
1543 (BOOL)(fn)((hwnd), (const LVSETINFOTIP *)(lParam))
1544
1545 /* UINT ListView_OnGetSelectedColumn(HWND hwnd) */
1546 #define HANDLE_LVM_GETSELECTEDCOLUMN(hwnd, wParam, lParam, fn) \
1547 (UINT)(fn)((hwnd))
1548
1549 /* BOOL ListView_OnIsGroupViewEnabled(HWND hwnd) */
1550 #define HANDLE_LVM_ISGROUPVIEWENABLED(hwnd, wParam, lParam, fn) \
1551 (BOOL)(fn)((hwnd))
1552
1553 /* COLORREF ListView_OnGetOutlineColor(HWND hwnd) */
1554 #define HANDLE_LVM_GETOUTLINECOLOR(hwnd, wParam, lParam, fn) \
1555 (COLORREF)(fn)((hwnd))
1556
1557 /* COLORREF ListView_OnSetOutlineColor(HWND hwnd, COLORREF color) */
1558 #define HANDLE_LVM_SETOUTLINECOLOR(hwnd, wParam, lParam, fn) \
1559 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1560
1561 /* void ListView_OnCancelEditLabel(HWND hwnd) */
1562 #define HANDLE_LVM_CANCELEDITLABEL(hwnd, wParam, lParam, fn) \
1563 ((fn)((hwnd)), 0L)
1564
1565 /* UINT ListView_OnMapIndexToID(HWND hwnd, UINT index) */
1566 #define HANDLE_LVM_MAPINDEXTOID(hwnd, wParam, lParam, fn) \
1567 (UINT)(fn)((hwnd), (UINT)(wParam))
1568
1569 /* UINT ListView_OnMapIDToIndex(HWND hwnd, UINT id) */
1570 #define HANDLE_LVM_MAPIDTOINDEX(hwnd, wParam, lParam, fn) \
1571 (UINT)(fn)((hwnd), (UINT)(wParam))
1572
1573 /* BOOL ListView_OnIsItemVisible(HWND hwnd, UINT index) */
1574 #define HANDLE_LVM_ISITEMVISIBLE(hwnd, wParam, lParam, fn) \
1575 (BOOL)(fn)((hwnd), (UINT)(wParam))
1576
1577 #if NTDDI_VERSION >= 0x06000000
1578 /* void ListView_OnGetEmptyText(HWND hwnd, PWSTR pszText, UINT cchText) */
1579 #define HANDLE_LVM_GETEMPTYTEXT(hwnd, wParam, lParam, fn) \
1580 ((fn)((hwnd), (PWSTR)(lParam), (UINT)(wParam)), 0L)
1581
1582 /* BOOL ListView_OnGetFooterRect(HWND hwnd, RECT *prc) */
1583 #define HANDLE_LVM_GETFOOTERRECT(hwnd, wParam, lParam, fn) \
1584 (BOOL)(fn)((hwnd), (RECT *)(lParam))
1585
1586 /* BOOL ListView_OnGetFooterInfo(HWND hwnd, LVFOOTERINFO *plvfi) */
1587 #define HANDLE_LVM_GETFOOTERINFO(hwnd, wParam, lParam, fn) \
1588 (BOOL)(fn)((hwnd), (LVFOOTERINFO *)(lParam))
1589
1590 /* BOOL ListView_OnGetFooterItemRect(HWND hwnd, INT iItem, RECT *prc) */
1591 #define HANDLE_LVM_GETFOOTERITEMRECT(hwnd, wParam, lParam, fn) \
1592 (BOOL)(fn)((hwnd), (INT)(wParam), (RECT *)(lParam))
1593
1594 /* BOOL ListView_OnGetFooterItem(HWND hwnd, INT iItem, LVFOOTERITEM *pfi) */
1595 #define HANDLE_LVM_GETFOOTERITEM(hwnd, wParam, lParam, fn) \
1596 (BOOL)(fn)((hwnd), (INT)(wParam), (LVFOOTERITEM *)(lParam))
1597
1598 /* BOOL ListView_OnGetItemIndexRect(HWND hwnd, const LVITEMINDEX *plvii, RECT *prc) */
1599 #define HANDLE_LVM_GETITEMINDEXRECT(hwnd, wParam, lParam, fn) \
1600 (BOOL)(fn)((hwnd), (const LVITEMINDEX *)(wParam), (RECT *)(lParam))
1601
1602 /* HRESULT ListView_OnSetItemIndexState(HWND hwnd, const LVITEMINDEX *plvii, const LV_ITEM *lvi) */
1603 #define HANDLE_LVM_SETITEMINDEXSTATE(hwnd, wParam, lParam, fn) \
1604 (HRESULT)(fn)((hwnd), (const LVITEMINDEX *)(wParam), (const LV_ITEM *)(lParam))
1605
1606 /* BOOL ListView_OnGetNextItemIndex(HWND hwnd, LVITEMINDEX *plvii, UINT flags) */
1607 #define HANDLE_LVM_GETNEXTITEMINDEX(hwnd, wParam, lParam, fn) \
1608 (BOOL)(fn)((hwnd), (LVITEMINDEX *)(wParam), (UINT)(lParam))
1609 #endif
1610
1611 /* HTREEITEM TreeView_OnInsertItemA(HWND hwnd, LPTV_INSERTSTRUCTA lpis) */
1612 #define HANDLE_TVM_INSERTITEMA(hwnd, wParam, lParam, fn) \
1613 (LRESULT)(HTREEITEM)(fn)((hwnd), (LPTV_INSERTSTRUCTA)(lParam))
1614
1615 /* BOOL TreeView_OnDeleteItem(HWND hwnd, HTREEITEM hitem) */
1616 #define HANDLE_TVM_DELETEITEM(hwnd, wParam, lParam, fn) \
1617 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam))
1618
1619 /* BOOL TreeView_OnExpand(HWND hwnd, HTREEITEM hitem, UINT code) */
1620 #define HANDLE_TVM_EXPAND(hwnd, wParam, lParam, fn) \
1621 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam), (UINT)(wParam))
1622
1623 /* BOOL TreeView_OnGetItemRect(HWND hwnd, UINT code, RECT *prc) */
1624 #define HANDLE_TVM_GETITEMRECT(hwnd, wParam, lParam, fn) \
1625 (BOOL)(fn)((hwnd), (UINT)(wParam), (RECT *)(lParam))
1626
1627 /* UINT TreeView_OnGetCount(HWND hwnd) */
1628 #define HANDLE_TVM_GETCOUNT(hwnd, wParam, lParam, fn) \
1629 (UINT)(fn)((hwnd))
1630
1631 /* UINT TreeView_OnGetIndent(HWND hwnd) */
1632 #define HANDLE_TVM_GETINDENT(hwnd, wParam, lParam, fn) \
1633 (UINT)(fn)((hwnd))
1634
1635 /* BOOL TreeView_OnSetIndent(HWND hwnd, INT indent) */
1636 #define HANDLE_TVM_SETINDENT(hwnd, wParam, lParam, fn) \
1637 (BOOL)(fn)((hwnd), (INT)(wParam))
1638
1639 /* HIMAGELIST TreeView_OnGetImageList(HWND hwnd, INT iImage) */
1640 #define HANDLE_TVM_GETIMAGELIST(hwnd, wParam, lParam, fn) \
1641 (LRESULT)(HIMAGELIST)(fn)((hwnd), (INT)(wParam))
1642
1643 /* HIMAGELIST TreeView_OnSetImageList(HWND hwnd, INT iImage, HIMAGELIST himl) */
1644 #define HANDLE_TVM_SETIMAGELIST(hwnd, wParam, lParam, fn) \
1645 (LRESULT)(HIMAGELIST)(fn)((hwnd), (INT)(wParam), (HIMAGELIST)(lParam))
1646
1647 /* HTREEITEM TreeView_OnGetNextItem(HWND hwnd, HTREEITEM hitem, UINT code) */
1648 #define HANDLE_TVM_GETNEXTITEM(hwnd, wParam, lParam, fn) \
1649 (LRESULT)(HTREEITEM)(fn)((hwnd), (HTREEITEM)(lParam), (UINT)(wParam))
1650
1651 /* BOOL TreeView_OnSelectItem(HWND hwnd, UINT code, HTREEITEM hitem) */
1652 #define HANDLE_TVM_SELECTITEM(hwnd, wParam, lParam, fn) \
1653 (BOOL)(fn)((hwnd), (UINT)(wParam), (HTREEITEM)(lParam))
1654
1655 /* BOOL TreeView_OnGetItemA(HWND hwnd, TV_ITEMA *pitem) */
1656 #define HANDLE_TVM_GETITEMA(hwnd, wParam, lParam, fn) \
1657 (BOOL)(fn)((hwnd), (TV_ITEMA *)(lParam))
1658
1659 /* BOOL TreeView_OnSetItemA(HWND hwnd, const TV_ITEMA *pitem) */
1660 #define HANDLE_TVM_SETITEMA(hwnd, wParam, lParam, fn) \
1661 (BOOL)(fn)((hwnd), (const TV_ITEMA *)(lParam))
1662
1663 /* HWND TreeView_OnEditLabelA(HWND hwnd, HTREEITEM hitem) */
1664 #define HANDLE_TVM_EDITLABELA(hwnd, wParam, lParam, fn) \
1665 (LRESULT)(HWND)(fn)((hwnd), (HTREEITEM)(lParam))
1666
1667 /* HWND TreeView_OnGetEditControl(HWND hwnd) */
1668 #define HANDLE_TVM_GETEDITCONTROL(hwnd, wParam, lParam, fn) \
1669 (LRESULT)(HWND)(fn)((hwnd))
1670
1671 /* UINT TreeView_OnGetVisibleCount(HWND hwnd) */
1672 #define HANDLE_TVM_GETVISIBLECOUNT(hwnd, wParam, lParam, fn) \
1673 (UINT)(fn)((hwnd))
1674
1675 /* HTREEITEM TreeView_OnHitTest(HWND hwnd, LPTV_HITTESTINFO lpht) */
1676 #define HANDLE_TVM_HITTEST(hwnd, wParam, lParam, fn) \
1677 (LRESULT)(HTREEITEM)(fn)((hwnd), (LPTV_HITTESTINFO)(lParam))
1678
1679 /* HIMAGELIST TreeView_OnCreateDragImage(HWND hwnd, HTREEITEM hitem) */
1680 #define HANDLE_TVM_CREATEDRAGIMAGE(hwnd, wParam, lParam, fn) \
1681 (LRESULT)(HIMAGELIST)(fn)((hwnd), (HTREEITEM)(lParam))
1682
1683 /* BOOL TreeView_OnSortChildren(HWND hwnd, HTREEITEM hitem, BOOL recurse) */
1684 #define HANDLE_TVM_SORTCHILDREN(hwnd, wParam, lParam, fn) \
1685 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam), (BOOL)(wParam))
1686
1687 /* BOOL TreeView_OnEnsureVisible(HWND hwnd, HTREEITEM hitem) */
1688 #define HANDLE_TVM_ENSUREVISIBLE(hwnd, wParam, lParam, fn) \
1689 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam))
1690
1691 /* BOOL TreeView_OnSortChildrenCB(HWND hwnd, LPTV_SORTCB psort, BOOL recurse) */
1692 #define HANDLE_TVM_SORTCHILDRENCB(hwnd, wParam, lParam, fn) \
1693 (BOOL)(fn)((hwnd), (LPTV_SORTCB)(lParam), (BOOL)(wParam))
1694
1695 /* BOOL TreeView_OnEndEditLabelNow(HWND hwnd, BOOL fCancel) */
1696 #define HANDLE_TVM_ENDEDITLABELNOW(hwnd, wParam, lParam, fn) \
1697 (BOOL)(fn)((hwnd), (BOOL)(wParam))
1698
1699 /* BOOL TreeView_OnGetISearchStringA(HWND hwnd, LPSTR lpsz) */
1700 #define HANDLE_TVM_GETISEARCHSTRINGA(hwnd, wParam, lParam, fn) \
1701 (BOOL)(fn)((hwnd), (LPSTR)(lParam))
1702
1703 /* HWND TreeView_OnSetToolTips(HWND hwnd, HWND hwndTT) */
1704 #define HANDLE_TVM_SETTOOLTIPS(hwnd, wParam, lParam, fn) \
1705 (LRESULT)(HWND)(fn)((hwnd), (HWND)(wParam))
1706
1707 /* HWND TreeView_OnGetToolTips(HWND hwnd) */
1708 #define HANDLE_TVM_GETTOOLTIPS(hwnd, wParam, lParam, fn) \
1709 (LRESULT)(HWND)(fn)((hwnd))
1710
1711 /* BOOL TreeView_OnSetInsertMark(HWND hwnd, HTREEITEM hItem, BOOL fAfter) */
1712 #define HANDLE_TVM_SETINSERTMARK(hwnd, wParam, lParam, fn) \
1713 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam), (BOOL)(wParam))
1714
1715 /* INT TreeView_OnSetItemHeight(HWND hwnd, INT iHeight) */
1716 #define HANDLE_TVM_SETITEMHEIGHT(hwnd, wParam, lParam, fn) \
1717 (INT)(fn)((hwnd), (INT)(wParam))
1718
1719 /* INT TreeView_OnGetItemHeight(HWND hwnd) */
1720 #define HANDLE_TVM_GETITEMHEIGHT(hwnd, wParam, lParam, fn) \
1721 (INT)(fn)((hwnd))
1722
1723 /* COLORREF TreeView_OnSetBkColor(HWND hwnd, COLORREF clr) */
1724 #define HANDLE_TVM_SETBKCOLOR(hwnd, wParam, lParam, fn) \
1725 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1726
1727 /* COLORREF TreeView_OnSetTextColor(HWND hwnd, COLORREF clr) */
1728 #define HANDLE_TVM_SETTEXTCOLOR(hwnd, wParam, lParam, fn) \
1729 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1730
1731 /* COLORREF TreeView_OnGetBkColor(HWND hwnd) */
1732 #define HANDLE_TVM_GETBKCOLOR(hwnd, wParam, lParam, fn) \
1733 (COLORREF)(fn)((hwnd))
1734
1735 /* COLORREF TreeView_OnGetTextColor(HWND hwnd) */
1736 #define HANDLE_TVM_GETTEXTCOLOR(hwnd, wParam, lParam, fn) \
1737 (COLORREF)(fn)((hwnd))
1738
1739 /* UINT TreeView_OnSetScrollTime(HWND hwnd, UINT uTime) */
1740 #define HANDLE_TVM_SETSCROLLTIME(hwnd, wParam, lParam, fn) \
1741 (UINT)(fn)((hwnd), (UINT)(wParam))
1742
1743 /* UINT TreeView_OnGetScrollTime(HWND hwnd) */
1744 #define HANDLE_TVM_GETSCROLLTIME(hwnd, wParam, lParam, fn) \
1745 (UINT)(fn)((hwnd))
1746
1747 #if NTDDI_VERSION >= 0x06000000
1748 /* INT TreeView_OnSetBorder(HWND hwnd, DWORD dwFlags, INT xBorder, INT yBorder) */
1749 #define HANDLE_TVM_SETBORDER(hwnd, wParam, lParam, fn) \
1750 (INT)(fn)((hwnd), (DWORD)(wParam), (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam))
1751 #endif
1752
1753 /* COLORREF TreeView_OnSetInsertMarkColor(HWND hwnd, COLORREF clr) */
1754 #define HANDLE_TVM_SETINSERTMARKCOLOR(hwnd, wParam, lParam, fn) \
1755 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1756
1757 /* COLORREF TreeView_OnGetInsertMarkColor(HWND hwnd) */
1758 #define HANDLE_TVM_GETINSERTMARKCOLOR(hwnd, wParam, lParam, fn) \
1759 (COLORREF)(fn)((hwnd))
1760
1761 /* UINT TreeView_OnGetItemState(HWND hwnd, HTREEITEM hti, UINT mask) */
1762 #define HANDLE_TVM_GETITEMSTATE(hwnd, wParam, lParam, fn) \
1763 (UINT)(fn)((hwnd), (HTREEITEM)(wParam), (UINT)(lParam))
1764
1765 /* COLORREF TreeView_OnSetLineColor(HWND hwnd, COLORREF clr) */
1766 #define HANDLE_TVM_SETLINECOLOR(hwnd, wParam, lParam, fn) \
1767 (COLORREF)(fn)((hwnd), (COLORREF)(lParam))
1768
1769 /* COLORREF TreeView_OnGetLineColor(HWND hwnd) */
1770 #define HANDLE_TVM_GETLINECOLOR(hwnd, wParam, lParam, fn) \
1771 (COLORREF)(fn)((hwnd))
1772
1773 /* HTREEITEM TreeView_OnMapAccIDToHTREEITEM(HWND hwnd, UINT id) */
1774 #define HANDLE_TVM_MAPACCIDTOHTREEITEM(hwnd, wParam, lParam, fn) \
1775 (LRESULT)(HTREEITEM)(fn)((hwnd), (UINT)(wParam))
1776
1777 /* UINT TreeView_OnMapHTREEITEMToAccID(HWND hwnd, HTREEITEM htreeitem) */
1778 #define HANDLE_TVM_MAPHTREEITEMTOACCID(hwnd, wParam, lParam, fn) \
1779 (UINT)(fn)((hwnd), (HTREEITEM)(wParam))
1780
1781 #if NTDDI_VERSION >= 0x06000000
1782 /* DWORD TreeView_OnSetExtendedStyle(HWND hwnd, DWORD dw, DWORD mask) */
1783 #define HANDLE_TVM_SETEXTENDEDSTYLE(hwnd, wParam, lParam, fn) \
1784 (DWORD)(fn)((hwnd), (DWORD)(wParam), (DWORD)(lParam))
1785
1786 /* DWORD TreeView_OnGetExtendedStyle(HWND hwnd) */
1787 #define HANDLE_TVM_GETEXTENDEDSTYLE(hwnd, wParam, lParam, fn) \
1788 (DWORD)(fn)((hwnd))
1789 #endif
1790
1791 /* HTREEITEM TreeView_OnInsertItemW(HWND hwnd, LPTV_INSERTSTRUCTW lpis) */
1792 #define HANDLE_TVM_INSERTITEMW(hwnd, wParam, lParam, fn) \
1793 (LRESULT)(HTREEITEM)(fn)((hwnd), (LPTV_INSERTSTRUCTW)(lParam))
1794
1795 #if NTDDI_VERSION >= 0x06000000
1796 /* BOOL TreeView_OnSetHot(HWND hwnd, HTREEITEM hitem) */
1797 #define HANDLE_TVM_SETHOT(hwnd, wParam, lParam, fn) \
1798 (BOOL)(fn)((hwnd), (HTREEITEM)(lParam))
1799
1800 /* BOOL TreeView_OnSetAutoScrollInfo(HWND hwnd, UINT uPixPerSec, UINT uUpdateTime) */
1801 #define HANDLE_TVM_SETAUTOSCROLLINFO(hwnd, wParam, lParam, fn) \
1802 (BOOL)(fn)((hwnd), (UINT)(wParam), (UINT)(lParam))
1803 #endif
1804
1805 /* BOOL TreeView_OnGetItemW(HWND hwnd, TV_ITEMW *pitem) */
1806 #define HANDLE_TVM_GETITEMW(hwnd, wParam, lParam, fn) \
1807 (BOOL)(fn)((hwnd), (TV_ITEMW *)(lParam))
1808
1809 /* BOOL TreeView_OnSetItemW(HWND hwnd, const TV_ITEMW *pitem) */
1810 #define HANDLE_TVM_SETITEMW(hwnd, wParam, lParam, fn) \
1811 (BOOL)(fn)((hwnd), (const TV_ITEMW *)(lParam))
1812
1813 /* BOOL TreeView_OnGetISearchStringW(HWND hwnd, LPWSTR lpsz) */
1814 #define HANDLE_TVM_GETISEARCHSTRINGW(hwnd, wParam, lParam, fn) \
1815 (BOOL)(fn)((hwnd), (LPWSTR)(lParam))
1816
1817 /* HWND TreeView_OnEditLabelW(HWND hwnd, HTREEITEM hitem) */
1818 #define HANDLE_TVM_EDITLABELW(hwnd, wParam, lParam, fn) \
1819 (LRESULT)(HWND)(fn)((hwnd), (HTREEITEM)(lParam))
1820
1821 #if NTDDI_VERSION >= 0x06000000
1822 /* DWORD TreeView_OnGetSelectedCount(HWND hwnd) */
1823 #define HANDLE_TVM_GETSELECTEDCOUNT(hwnd, wParam, lParam, fn) \
1824 (DWORD)(fn)((hwnd))
1825
1826 /* DWORD TreeView_OnShowInfoTip(HWND hwnd, HTREEITEM hitem) */
1827 #define HANDLE_TVM_SHOWINFOTIP(hwnd, wParam, lParam, fn) \
1828 (DWORD)(fn)((hwnd), (HTREEITEM)(lParam))
1829
1830 /* LRESULT TreeView_OnGetItemPartRect(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1831 #define HANDLE_TVM_GETITEMPARTRECT(hwnd, wParam, lParam, fn) \
1832 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1833 #endif
1834
1835 #ifdef _UNDOCUSER_H /* UNDOCUMENTED */
1836 /* LRESULT Cls_OnDropObject(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1837 #ifndef HANDLE_WM_DROPOBJECT
1838 #define HANDLE_WM_DROPOBJECT(hwnd, wParam, lParam, fn) \
1839 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1840 #define FORWARD_WM_DROPOBJECT(hwnd, wParam, lParam, fn) \
1841 (LRESULT)((fn)((hwnd), WM_DROPOBJECT, wParam, lParam))
1842 #endif
1843
1844 /* LRESULT Cls_OnQueryDropObject(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1845 #ifndef HANDLE_WM_QUERYDROPOBJECT
1846 #define HANDLE_WM_QUERYDROPOBJECT(hwnd, wParam, lParam, fn) \
1847 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1848 #define FORWARD_WM_QUERYDROPOBJECT(hwnd, wParam, lParam, fn) \
1849 (LRESULT)((fn)((hwnd), WM_QUERYDROPOBJECT, wParam, lParam))
1850 #endif
1851
1852 /* LRESULT Cls_OnBeginDrag(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1853 #ifndef HANDLE_WM_BEGINDRAG
1854 #define HANDLE_WM_BEGINDRAG(hwnd, wParam, lParam, fn) \
1855 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1856 #define FORWARD_WM_BEGINDRAG(hwnd, wParam, lParam, fn) \
1857 (LRESULT)((fn)((hwnd), WM_BEGINDRAG, wParam, lParam))
1858 #endif
1859
1860 /* LRESULT Cls_OnDragLoop(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1861 #ifndef HANDLE_WM_DRAGLOOP
1862 #define HANDLE_WM_DRAGLOOP(hwnd, wParam, lParam, fn) \
1863 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1864 #define FORWARD_WM_DRAGLOOP(hwnd, wParam, lParam, fn) \
1865 (LRESULT)((fn)((hwnd), WM_DRAGLOOP, wParam, lParam))
1866 #endif
1867
1868 /* LRESULT Cls_OnDragSelect(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1869 #ifndef HANDLE_WM_DRAGSELECT
1870 #define HANDLE_WM_DRAGSELECT(hwnd, wParam, lParam, fn) \
1871 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1872 #define FORWARD_WM_DRAGSELECT(hwnd, wParam, lParam, fn) \
1873 (LRESULT)((fn)((hwnd), WM_DRAGSELECT, wParam, lParam))
1874 #endif
1875
1876 /* LRESULT Cls_OnDragMove(HWND hwnd, WPARAM wParam, LPARAM lParam) */
1877 #ifndef HANDLE_WM_DRAGMOVE
1878 #define HANDLE_WM_DRAGMOVE(hwnd, wParam, lParam, fn) \
1879 (LRESULT)(fn)((hwnd), (wParam), (lParam))
1880 #define FORWARD_WM_DRAGMOVE(hwnd, wParam, lParam, fn) \
1881 (LRESULT)((fn)((hwnd), WM_DRAGMOVE, wParam, lParam))
1882 #endif
1883 #endif
1884
1885 #endif