Removed "elfdll" load order option and updated documentation.
[wine/multimedia.git] / include / windowsx.h
blob4ba4939a272f3b659f2eb037b969ff0b9303d9e1
1 /* Copyright (C) 1999 Corel Corporation (Paul Quinn) */
3 #ifndef _INC_WINDOWSX
4 #define _INC_WINDOWSX
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #ifndef SNDMSG
11 #ifdef __cplusplus
12 #define SNDMSG ::SendMessage
13 #else /* __cplusplus */
14 #define SNDMSG SendMessage
15 #endif /* __cplusplus */
16 #endif /* SNDMSG */
18 #define GET_WPARAM(wp, lp) (wp)
19 #define GET_LPARAM(wp, lp) (lp)
21 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
22 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
24 #define GET_EM_LINESCROLL_MPS(vert, horz) (WPARAM)horz, (LONG)vert
26 #define GET_EM_SETSEL_START(wp, lp) (INT)(wp)
27 #define GET_EM_SETSEL_END(wp, lp) (lp)
28 #define GET_EM_SETSEL_MPS(iStart, iEnd) (WPARAM)(iStart), (LONG)(iEnd)
30 #define GET_WM_ACTIVATE_STATE(wp, lp) LOWORD(wp)
31 #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(wp)
32 #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)(lp)
33 #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) (WPARAM)MAKELONG((s), (fmin)), (LONG)(hwnd)
35 #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)(lp)
37 #define GET_WM_CHARTOITEM_CHAR(wp, lp) (TCHAR)LOWORD(wp)
38 #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(wp)
39 #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)(lp)
40 #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) (WPARAM)MAKELONG((pos), (ch)), (LONG)(hwnd)
42 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
43 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
44 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
45 #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
47 #define WM_CTLCOLOR 0x0019
49 #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
50 #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
51 #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
52 #define GET_WM_CTLCOLOR_MSG(type) (WORD)(WM_CTLCOLORMSGBOX+(type))
53 #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), (LONG)(hwnd)
55 #define GET_WM_HSCROLL_CODE(wp, lp) LOWORD(wp)
56 #define GET_WM_HSCROLL_POS(wp, lp) HIWORD(wp)
57 #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)(lp)
58 #define GET_WM_HSCROLL_MPS(code, pos, hwnd) (WPARAM)MAKELONG(code, pos), (LONG)(hwnd)
60 #define GET_WM_MENUCHAR_CHAR(wp, lp) (TCHAR)LOWORD(wp)
61 #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)(lp)
62 #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(wp)
63 #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) (WPARAM)MAKELONG(ch, f), (LONG)(hmenu)
65 #define GET_WM_MENUSELECT_CMD(wp, lp) LOWORD(wp)
66 #define GET_WM_MENUSELECT_FLAGS(wp, lp) (UINT)(int)(short)HIWORD(wp)
67 #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)(lp)
68 #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) (WPARAM)MAKELONG(cmd, f), (LONG)(hmenu)
70 #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (lp == (LONG)hwnd)
71 #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)(wp)
72 #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)(lp)
73 #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA) (WPARAM)(hwndA), 0
74 #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) (WPARAM)hmenuF, (LONG)hmenuW
76 #define GET_WM_PARENTNOTIFY_MSG(wp, lp) LOWORD(wp)
77 #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(wp)
78 #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)(lp)
79 #define GET_WM_PARENTNOTIFY_X(wp, lp) (int)(short)LOWORD(lp)
80 #define GET_WM_PARENTNOTIFY_Y(wp, lp) (int)(short)HIWORD(lp)
81 #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) (WPARAM)MAKELONG(id, msg), (LONG)(hwnd)
82 #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) (WPARAM)MAKELONG(0, msg), MAKELONG(x, y)
84 #define GET_WM_VKEYTOITEM_CODE(wp, lp) (int)(short)LOWORD(wp)
85 #define GET_WM_VKEYTOITEM_ITEM(wp, lp) HIWORD(wp)
86 #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)(lp)
87 #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)MAKELONG(item, code), (LONG)(hwnd)
89 #define GET_WM_VSCROLL_CODE(wp, lp) LOWORD(wp)
90 #define GET_WM_VSCROLL_POS(wp, lp) HIWORD(wp)
91 #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)(lp)
92 #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)MAKELONG(code, pos), (LONG)(hwnd)
94 /****** KERNEL Macro APIs ******************************************************/
96 #define GetInstanceModule(hInst) (GetModuleHandle((LPCSTR)MAKELP(0, hInst)))
97 #define GlobalPtrHandle(lp) ((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp))))
98 #define GlobalLockPtr(lp) ((BOOL)SELECTOROF(GlobalLock(GlobalPtrHandle(lp))))
99 #define GlobalUnlockPtr(lp) (GlobalUnlock(GlobalPtrHandle(lp)))
100 #define GlobalAllocPtr(flags,cb) (GlobalLock(GlobalAlloc((flags), (cb))))
101 #define GlobalReAllocPtr(lp, cbNew, flags) (GlobalUnlockPtr(lp), \
102 GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
103 #define GlobalFreePtr(lp) (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
105 /****** USER Macro APIs ******************************************************/
107 #define GetWindowInstance(hwnd) ((HMODULE)GetWindowLong(hwnd, GWL_HINSTANCE))
109 #define GetWindowStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_STYLE))
110 #define GetWindowExStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_EXSTYLE))
112 #define GetWindowOwner(hwnd) GetWindow(hwnd, GW_OWNER)
114 #define GetFirstChild(hwnd) GetTopWindow(hwnd)
115 #define GetFirstSibling(hwnd) GetWindow(hwnd, GW_HWNDFIRST)
116 #define GetLastSibling(hwnd) GetWindow(hwnd, GW_HWNDLAST)
117 #define GetNextSibling(hwnd) GetWindow(hwnd, GW_HWNDNEXT)
118 #define GetPrevSibling(hwnd) GetWindow(hwnd, GW_HWNDPREV)
120 #define GetWindowID(hwnd) GetDlgCtrlID(hwnd)
122 #define SetWindowRedraw(hwnd, fRedraw) \
123 ((void)SendMessage(hwnd, WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L))
124 #define SubclassWindow(hwnd, lpfn) \
125 ((WNDPROC)SetWindowLong((hwnd), GWL_WNDPROC, (LPARAM)(WNDPROC)(lpfn)))
127 #define IsMinimized(hwnd) IsIconic(hwnd)
128 #define IsMaximized(hwnd) IsZoomed(hwnd)
129 #define IsRestored(hwnd) ((GetWindowStyle(hwnd) & (WS_MINIMIZE | WS_MAXIMIZE)) == 0L)
130 #define SetWindowFont(hwnd, hfont, fRedraw) \
131 FORWARD_WM_SETFONT((hwnd), (hfont), (fRedraw), SendMessage)
133 #define GetWindowFont(hwnd) FORWARD_WM_GETFONT((hwnd), SendMessage)
135 #define MapWindowRect(hwndFrom, hwndTo, lprc) \
136 MapWindowPoints((hwndFrom), (hwndTo), (POINT *)(lprc), 2)
138 #define IsLButtonDown() (GetKeyState(VK_LBUTTON) < 0)
139 #define IsRButtonDown() (GetKeyState(VK_RBUTTON) < 0)
140 #define IsMButtonDown() (GetKeyState(VK_MBUTTON) < 0)
142 #define SetDlgMsgResult(hwnd, msg, result) (( \
143 (msg) == WM_CTLCOLORMSGBOX || \
144 (msg) == WM_CTLCOLOREDIT || \
145 (msg) == WM_CTLCOLORLISTBOX || \
146 (msg) == WM_CTLCOLORBTN || \
147 (msg) == WM_CTLCOLORDLG || \
148 (msg) == WM_CTLCOLORSCROLLBAR || \
149 (msg) == WM_CTLCOLORSTATIC || \
150 (msg) == WM_COMPAREITEM || \
151 (msg) == WM_VKEYTOITEM || \
152 (msg) == WM_CHARTOITEM || \
153 (msg) == WM_QUERYDRAGICON || \
154 (msg) == WM_INITDIALOG \
155 ) ? (BOOL)(result) : (SetWindowLong((hwnd), DWL_MSGRESULT, (LPARAM)(LRESULT)(result)), TRUE))
157 #define DefDlgProcEx(hwnd, msg, wParam, lParam, pfRecursion) \
158 (*(pfRecursion) = TRUE, DefDlgProc(hwnd, msg, wParam, lParam))
160 #define CheckDefDlgRecursion(pfRecursion) \
161 if (*(pfRecursion)) { *(pfRecursion) = FALSE; return FALSE; }
163 #define SubclassDialog(hwndDlg, lpfn) \
164 ((DLGPROC)SetWindowLong(hwndDlg, DWL_DLGPROC, (LPARAM)(DLGPROC)(lpfn)))
166 #define DeletePen(hpen) DeleteObject((HGDIOBJ)(HPEN)(hpen))
167 #define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen)))
168 #define GetStockPen(i) ((HPEN)GetStockObject(i))
170 #define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr))
171 #define SelectBrush(hdc, hbr) ((HBRUSH)SelectObject((hdc), (HGDIOBJ)(HBRUSH)(hbr)))
172 #define GetStockBrush(i) ((HBRUSH)GetStockObject(i))
174 #define DeleteRgn(hrgn) DeleteObject((HGDIOBJ)(HRGN)(hrgn))
176 #define CopyRgn(hrgnDst, hrgnSrc) CombineRgn(hrgnDst, hrgnSrc, 0, RGN_COPY)
177 #define IntersectRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND)
178 #define SubtractRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF)
179 #define UnionRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR)
180 #define XorRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR)
182 #define DeletePalette(hpal) DeleteObject((HGDIOBJ)(HPALETTE)(hpal))
184 #define DeleteFont(hfont) DeleteObject((HGDIOBJ)(HFONT)(hfont))
185 #define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT) (hfont)))
186 #define GetStockFont(i) ((HFONT)GetStockObject(i))
187 #define DeleteBitmap(hbm) DeleteObject((HGDIOBJ)(HBITMAP)(hbm))
188 #define SelectBitmap(hdc, hbm) ((HBITMAP)SelectObject((hdc), (HGDIOBJ)(HBITMAP)(hbm)))
189 #define InsetRect(lprc, dx, dy) InflateRect((lprc), -(dx), -(dy))
192 /* Button Message APIs */
194 #define Button_Enable(hwndCtl, fEnable) \
195 EnableWindow((hwndCtl), (fEnable))
197 #define Button_GetCheck(hwndCtl) \
198 ((int)SendMessage((hwndCtl), BM_GETCHECK, 0L, 0L))
200 #define Button_GetState(hwndCtl) \
201 ((int)SendMessage((hwndCtl), BM_GETSTATE, 0L, 0L))
203 #define Button_GetText(hwndCtl, lpch, cchMax) \
204 GetWindowText((hwndCtl), (lpch), (cchMax))
206 #define Button_GetTextLength(hwndCtl) \
207 GetWindowTextLength(hwndCtl)
209 #define Button_SetCheck(hwndCtl, check) \
210 ((void)SendMessage((hwndCtl), BM_SETCHECK, (WPARAM)(int)(check), 0L))
212 #define Button_SetState(hwndCtl, state) \
213 ((UINT)SendMessage((hwndCtl), BM_SETSTATE, (WPARAM)(int)(state), 0L))
215 #define Button_SetStyle(hwndCtl, style, fRedraw) \
216 ((void)SendMessage((hwndCtl), BM_SETSTYLE, (WPARAM)LOWORD(style), MAKELPARAM(((fRedraw) ? TRUE : FALSE), 0)))
218 #define Button_SetText(hwndCtl, lpsz) \
219 SetWindowText((hwndCtl), (lpsz))
222 /* ComboBox Message APIs */
224 #define ComboBox_AddItemData(hwndCtl, data) \
225 ((int)SendMessage((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(data)))
227 #define ComboBox_AddString(hwndCtl, lpsz) \
228 ((int)SendMessage((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
230 #define ComboBox_DeleteString(hwndCtl, index) \
231 ((int)SendMessage((hwndCtl), CB_DELETESTRING, (WPARAM)(int)(index), 0L))
233 #define ComboBox_Dir(hwndCtl, attrs, lpszFileSpec) \
234 ((int)SendMessage((hwndCtl), CB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCTSTR)(lpszFileSpec)))
236 #define ComboBox_Enable(hwndCtl, fEnable) \
237 EnableWindow((hwndCtl), (fEnable))
239 #define ComboBox_FindItemData(hwndCtl, indexStart, data) \
240 ((int)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
242 #define ComboBox_FindString(hwndCtl, indexStart, lpszFind) \
243 ((int)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
245 #define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind) \
246 ((int)SendMessage((hwndCtl), CB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
248 #define ComboBox_GetCount(hwndCtl) \
249 ((int)SendMessage((hwndCtl), CB_GETCOUNT, 0L, 0L))
251 #define ComboBox_GetCurSel(hwndCtl) \
252 ((int)SendMessage((hwndCtl), CB_GETCURSEL, 0L, 0L))
254 #define ComboBox_GetDroppedControlRect(hwndCtl, lprc) \
255 ((void)SendMessage((hwndCtl), CB_GETDROPPEDCONTROLRECT, 0L, (LPARAM)(RECT *)(lprc)))
257 #define ComboBox_GetDroppedState(hwndCtl) \
258 ((BOOL)SendMessage((hwndCtl), CB_GETDROPPEDSTATE, 0L, 0L))
260 #define ComboBox_GetEditSel(hwndCtl) \
261 ((DWORD)SendMessage((hwndCtl), CB_GETEDITSEL, 0L, 0L))
263 #define ComboBox_GetExtendedUI(hwndCtl) \
264 ((UINT)SendMessage((hwndCtl), CB_GETEXTENDEDUI, 0L, 0L))
266 #define ComboBox_GetItemData(hwndCtl, index) \
267 ((LRESULT)SendMessage((hwndCtl), CB_GETITEMDATA, (WPARAM)(int)(index), 0L))
269 #define ComboBox_GetItemHeight(hwndCtl) \
270 ((int)SendMessage((hwndCtl), CB_GETITEMHEIGHT, 0L, 0L))
272 #define ComboBox_GetLBText(hwndCtl, index, lpszBuffer) \
273 ((int)SendMessage((hwndCtl), CB_GETLBTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer)))
275 #define ComboBox_GetLBTextLen(hwndCtl, index) \
276 ((int)SendMessage((hwndCtl), CB_GETLBTEXTLEN, (WPARAM)(int)(index), 0L))
278 #define ComboBox_InsertItemData(hwndCtl, index, data) \
279 ((int)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(data)))
281 #define ComboBox_LimitText(hwndCtl, cchLimit) \
282 ((int)SendMessage((hwndCtl), CB_LIMITTEXT, (WPARAM)(int)(cchLimit), 0L))
284 #define ComboBox_GetText(hwndCtl, lpch, cchMax) \
285 GetWindowText((hwndCtl), (lpch), (cchMax))
287 #define ComboBox_GetTextLength(hwndCtl) \
288 GetWindowTextLength(hwndCtl)
290 #define ComboBox_InsertString(hwndCtl, index, lpsz) \
291 ((int)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpsz)))
293 #define ComboBox_LimitText(hwndCtl, cchLimit) \
294 ((int)SendMessage((hwndCtl), CB_LIMITTEXT, (WPARAM)(int)(cchLimit), 0L))
296 #define ComboBox_ResetContent(hwndCtl) \
297 ((int)SendMessage((hwndCtl), CB_RESETCONTENT, 0L, 0L))
299 #define ComboBox_SelectItemData(hwndCtl, indexStart, data) \
300 ((int)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
302 #define ComboBox_SelectString(hwndCtl, indexStart, lpszSelect) \
303 ((int)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszSelect)))
305 #define ComboBox_SetCurSel(hwndCtl, index) \
306 ((int)SendMessage((hwndCtl), CB_SETCURSEL, (WPARAM)(int)(index), 0L))
308 #define ComboBox_SetEditSel(hwndCtl, ichStart, ichEnd) \
309 ((int)SendMessage((hwndCtl), CB_SETEDITSEL, 0L, MAKELPARAM((ichStart), (ichEnd))))
311 #define ComboBox_SetExtendedUI(hwndCtl, flags) \
312 ((int)SendMessage((hwndCtl), CB_SETEXTENDEDUI, (WPARAM)(UINT)(flags), 0L))
314 #define ComboBox_SetItemData(hwndCtl, index, data) \
315 ((int)SendMessage((hwndCtl), CB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(DWORD)(data)))
317 #define ComboBox_SetItemHeight(hwndCtl, index, cyItem) \
318 ((int)SendMessage((hwndCtl), CB_SETITEMHEIGHT, (WPARAM)(int)(index), (LPARAM)(int)cyItem))
320 #define ComboBox_SetText(hwndCtl, lpsz) \
321 SetWindowText((hwndCtl), (lpsz))
323 #define ComboBox_ShowDropdown(hwndCtl, fShow) \
324 ((BOOL)SendMessage((hwndCtl), CB_SHOWDROPDOWN, (WPARAM)(BOOL)(fShow), 0L))
327 /* Edit Message APIs */
329 #define Edit_CanUndo(hwndCtl) \
330 ((BOOL)SendMessage((hwndCtl), EM_CANUNDO, 0L, 0L))
332 #define Edit_EmptyUndoBuffer(hwndCtl) \
333 ((void)SendMessage((hwndCtl), EM_EMPTYUNDOBUFFER, 0L, 0L))
335 #define Edit_Enable(hwndCtl, fEnable) \
336 EnableWindow((hwndCtl), (fEnable))
338 #define Edit_FmtLines(hwndCtl, fAddEOL) \
339 ((BOOL)SendMessage((hwndCtl), EM_FMTLINES, (WPARAM)(BOOL)(fAddEOL), 0L))
341 #define Edit_GetFirstVisibleLine(hwndCtl) \
342 ((int)SendMessage((hwndCtl), EM_GETFIRSTVISIBLELINE, 0L, 0L))
344 #define Edit_GetHandle(hwndCtl) \
345 ((HLOCAL)SendMessage((hwndCtl), EM_GETHANDLE, 0L, 0L))
347 #define Edit_GetLine(hwndCtl, line, lpch, cchMax) \
348 ((*((int *)(lpch)) = (cchMax)), ((int)SendMessage((hwndCtl), EM_GETLINE, (WPARAM)(int)(line), (LPARAM)(LPTSTR)(lpch))))
350 #define Edit_GetModify(hwndCtl) \
351 ((BOOL)SendMessage((hwndCtl), EM_GETMODIFY, 0L, 0L))
353 #define Edit_GetPasswordChar(hwndCtl) \
354 ((TCHAR)SendMessage((hwndCtl), EM_GETPASSWORDCHAR, 0L, 0L))
356 #define Edit_GetRect(hwndCtl, lprc) \
357 ((void)SendMessage((hwndCtl), EM_GETRECT, 0L, (LPARAM)(RECT *)(lprc)))
359 #define Edit_GetSel(hwndCtl) \
360 ((DWORD)SendMessage((hwndCtl), EM_GETSEL, 0L, 0L))
362 #define Edit_GetText(hwndCtl, lpch, cchMax) \
363 GetWindowText((hwndCtl), (lpch), (cchMax))
365 #define Edit_GetTextLength(hwndCtl) \
366 GetWindowTextLength(hwndCtl)
368 #define Edit_GetWordBreakProc(hwndCtl) \
369 ((EDITWORDBREAKPROC)SendMessage((hwndCtl), EM_GETWORDBREAKPROC, 0L, 0L))
371 #define Edit_LimitText(hwndCtl, cchMax) \
372 ((void)SendMessage((hwndCtl), EM_LIMITTEXT, (WPARAM)(UINT)(cchMax), 0L))
374 #define Edit_LineFromChar(hwndCtl, ich) \
375 ((int)SendMessage((hwndCtl), EM_LINEFROMCHAR, (WPARAM)(int)(ich), 0L))
377 #define Edit_LineIndex(hwndCtl, line) \
378 ((int)SendMessage((hwndCtl), EM_LINEINDEX, (WPARAM)(int)(line), 0L))
380 #define Edit_GetLineCount(hwndCtl) \
381 ((int)SendMessage((hwndCtl), EM_GETLINECOUNT, 0L, 0L))
383 #define Edit_LineLength(hwndCtl, line) \
384 ((int)SendMessage((hwndCtl), EM_LINELENGTH, (WPARAM)(int)(line), 0L))
386 #define Edit_ReplaceSel(hwndCtl, lpszReplace) \
387 ((void)SendMessage((hwndCtl), EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR)(lpszReplace)))
389 #define Edit_Scroll(hwndCtl, dv, dh) \
390 ((void)SendMessage((hwndCtl), EM_LINESCROLL, (WPARAM)(int)(dh), (LPARAM)(int)(dv)))
392 #define Edit_ScrollCaret(hwndCtl) \
393 ((BOOL)SendMessage((hwndCtl), EM_SCROLLCARET, 0, 0L))
395 #define Edit_SetHandle(hwndCtl, h) \
396 ((void)SendMessage((hwndCtl), EM_SETHANDLE, (WPARAM)(UINT)(HLOCAL)(h), 0L))
398 #define Edit_SetModify(hwndCtl, fModified) \
399 ((void)SendMessage((hwndCtl), EM_SETMODIFY, (WPARAM)(UINT)(fModified), 0L))
401 #define Edit_SetPasswordChar(hwndCtl, ch) \
402 ((void)SendMessage((hwndCtl), EM_SETPASSWORDCHAR, (WPARAM)(UINT)(ch), 0L))
404 #define Edit_SetReadOnly(hwndCtl, fReadOnly) \
405 ((BOOL)SendMessage((hwndCtl), EM_SETREADONLY, (WPARAM)(BOOL)(fReadOnly), 0L))
407 #define Edit_SetRect(hwndCtl, lprc) \
408 ((void)SendMessage((hwndCtl), EM_SETRECT, 0L, (LPARAM)(const RECT *)(lprc)))
410 #define Edit_SetRectNoPaint(hwndCtl, lprc) \
411 ((void)SendMessage((hwndCtl), EM_SETRECTNP, 0L, (LPARAM)(const RECT *)(lprc)))
413 #define Edit_SetSel(hwndCtl, ichStart, ichEnd) \
414 ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd)))
416 #define Edit_SetTabStops(hwndCtl, cTabs, lpTabs) \
417 ((void)SendMessage((hwndCtl), EM_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(const int *)(lpTabs)))
419 #define Edit_SetText(hwndCtl, lpsz) \
420 SetWindowText((hwndCtl), (lpsz))
422 #define Edit_SetWordBreakProc(hwndCtl, lpfnWordBreak) \
423 ((void)SendMessage((hwndCtl), EM_SETWORDBREAKPROC, 0L, (LPARAM)(EDITWORDBREAKPROC)(lpfnWordBreak)))
425 #define Edit_Undo(hwndCtl) \
426 ((BOOL)SendMessage((hwndCtl), EM_UNDO, 0L, 0L))
429 /* ListBox Message APIs */
431 #define ListBox_AddItemData(hwndCtl, data) \
432 ((int)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(data)))
434 #define ListBox_AddString(hwndCtl, lpsz) \
435 ((int)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
437 #define ListBox_DeleteString(hwndCtl, index) \
438 ((int)SendMessage((hwndCtl), LB_DELETESTRING, (WPARAM)(int)(index), 0L))
440 #define ListBox_Dir(hwndCtl, attrs, lpszFileSpec) \
441 ((int)SendMessage((hwndCtl), LB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCTSTR)(lpszFileSpec)))
443 #define ListBox_Enable(hwndCtl, fEnable) \
444 EnableWindow((hwndCtl), (fEnable))
446 #define ListBox_FindItemData(hwndCtl, indexStart, data) \
447 ((int)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
449 #define ListBox_FindString(hwndCtl, indexStart, lpszFind) \
450 ((int)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
452 #define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind) \
453 ((int)SendMessage((hwndCtl), LB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
455 #define ListBox_GetCaretIndex(hwndCtl) \
456 ((int)SendMessage((hwndCtl), LB_GETCARETINDEX, 0L, 0L))
458 #define ListBox_GetCurSel(hwndCtl) \
459 ((int)SendMessage((hwndCtl), LB_GETCURSEL, 0L, 0L))
461 #define ListBox_GetCount(hwndCtl) \
462 ((int)SendMessage((hwndCtl), LB_GETCOUNT, 0L, 0L))
464 #define ListBox_GetHorizontalExtent(hwndCtl) \
465 ((int)SendMessage((hwndCtl), LB_GETHORIZONTALEXTENT, 0L, 0L))
467 #define ListBox_GetItemData(hwndCtl, index) \
468 ((LRESULT)SendMessage((hwndCtl), LB_GETITEMDATA, (WPARAM)(int)(index), 0L))
470 #define ListBox_GetItemHeight(hwndCtl, index) \
471 ((int)SendMessage((hwndCtl), LB_GETITEMHEIGHT, (WPARAM)(int)(index), 0L))
473 #define ListBox_GetItemRect(hwndCtl, index, lprc) \
474 ((int)SendMessage((hwndCtl), LB_GETITEMRECT, (WPARAM)(int)(index), (LPARAM)(RECT *)(lprc)))
476 #define ListBox_GetSel(hwndCtl, index) \
477 ((int)SendMessage((hwndCtl), LB_GETSEL, (WPARAM)(int)(index), 0L))
479 #define ListBox_GetSelCount(hwndCtl) \
480 ((int)SendMessage((hwndCtl), LB_GETSELCOUNT, 0L, 0L))
482 #define ListBox_GetSelItems(hwndCtl, cItems, lpItems) \
483 ((int)SendMessage((hwndCtl), LB_GETSELITEMS, (WPARAM)(int)(cItems), (LPARAM)(int *)(lpItems)))
485 #define ListBox_GetText(hwndCtl, index, lpszBuffer) \
486 ((int)SendMessage((hwndCtl), LB_GETTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer)))
488 #define ListBox_GetTextLen(hwndCtl, index) \
489 ((int)SendMessage((hwndCtl), LB_GETTEXTLEN, (WPARAM)(int)(index), 0L))
491 #define ListBox_GetTopIndex(hwndCtl) \
492 ((int)SendMessage((hwndCtl), LB_GETTOPINDEX, 0L, 0L))
494 #define ListBox_InsertItemData(hwndCtl, index, data) \
495 ((int)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(data)))
497 #define ListBox_InsertString(hwndCtl, index, lpsz) \
498 ((int)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpsz)))
500 #define ListBox_ResetContent(hwndCtl) \
501 ((BOOL)SendMessage((hwndCtl), LB_RESETCONTENT, 0L, 0L))
503 #define ListBox_SelectItemData(hwndCtl, indexStart, data) \
504 ((int)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
506 #define ListBox_SelectString(hwndCtl, indexStart, lpszFind) \
507 ((int)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
509 #define ListBox_SelItemRange(hwndCtl, fSelect, first, last) \
510 ((int)SendMessage((hwndCtl), LB_SELITEMRANGE, (WPARAM)(BOOL)(fSelect), MAKELPARAM((first), (last))))
512 #define ListBox_SetCaretIndex(hwndCtl, index) \
513 ((int)SendMessage((hwndCtl), LB_SETCARETINDEX, (WPARAM)(int)(index), 0L))
515 #define ListBox_SetColumnWidth(hwndCtl, cxColumn) \
516 ((void)SendMessage((hwndCtl), LB_SETCOLUMNWIDTH, (WPARAM)(int)(cxColumn), 0L))
518 #define ListBox_SetCurSel(hwndCtl, index) \
519 ((int)SendMessage((hwndCtl), LB_SETCURSEL, (WPARAM)(int)(index), 0L))
521 #define ListBox_SetHorizontalExtent(hwndCtl, cxExtent) \
522 ((void)SendMessage((hwndCtl), LB_SETHORIZONTALEXTENT, (WPARAM)(int)(cxExtent), 0L))
524 #define ListBox_SetItemData(hwndCtl, index, data) \
525 ((int)SendMessage((hwndCtl), LB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(DWORD)(data)))
527 #define ListBox_SetItemHeight(hwndCtl, index, cy) \
528 ((int)SendMessage((hwndCtl), LB_SETITEMHEIGHT, (WPARAM)(int)(index), MAKELPARAM((cy), 0)))
530 #define ListBox_SetSel(hwndCtl, fSelect, index) \
531 ((int)SendMessage((hwndCtl), LB_SETSEL, (WPARAM)(BOOL)(fSelect), (LPARAM)(UINT)(index)))
533 #define ListBox_SetTabStops(hwndCtl, cTabs, lpTabs) \
534 ((BOOL)SendMessage((hwndCtl), LB_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(int *)(lpTabs)))
536 #define ListBox_SetTopIndex(hwndCtl, indexTop) \
537 ((int)SendMessage((hwndCtl), LB_SETTOPINDEX, (WPARAM)(int)(indexTop), 0L))
540 /* Scrollbar Message APIs */
542 #define ScrollBar_Enable(hwndCtl, flags) \
543 EnableScrollBar((hwndCtl), SB_CTL, (flags))
545 #define ScrollBar_GetPos(hwndCtl) \
546 GetScrollPos((hwndCtl), SB_CTL)
548 #define ScrollBar_GetRange(hwndCtl, lpposMin, lpposMax) \
549 GetScrollRange((hwndCtl), SB_CTL, (lpposMin), (lpposMax))
551 #define ScrollBar_SetPos(hwndCtl, pos, fRedraw) \
552 SetScrollPos((hwndCtl), SB_CTL, (pos), (fRedraw))
554 #define ScrollBar_SetRange(hwndCtl, posMin, posMax, fRedraw) \
555 SetScrollRange((hwndCtl), SB_CTL, (posMin), (posMax), (fRedraw))
557 #define ScrollBar_Show(hwndCtl, fShow) \
558 ShowWindow((hwndCtl), (fShow) ? SW_SHOWNORMAL : SW_HIDE)
561 /* Static Message APIs */
563 #define Static_Enable(hwndCtl, fEnable) \
564 EnableWindow((hwndCtl), (fEnable))
566 #define Static_GetIcon(hwndCtl, hIcon) \
567 ((HICON)SendMessage((hwndCtl), STM_GETICON, 0L, 0L))
569 #define Static_GetText(hwndCtl, lpch, cchMax) \
570 GetWindowText((hwndCtl), (lpch), (cchMax))
572 #define Static_GetTextLength(hwndCtl) \
573 GetWindowTextLength(hwndCtl)
575 #define Static_SetIcon(hwndCtl, hIcon) \
576 ((HICON)SendMessage((hwndCtl), STM_SETICON, (WPARAM)(HICON)(hIcon), 0L))
578 #define Static_SetText(hwndCtl, lpsz) \
579 SetWindowText((hwndCtl), (lpsz))
582 /****** Message crackers ****************************************************/
584 #define HANDLE_MSG(hwnd, message, fn) \
585 case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
587 /* void Cls_OnCompacting(HWND hwnd, UINT compactRatio) */
588 #define HANDLE_WM_COMPACTING(hwnd, wParam, lParam, fn) \
589 ((fn)((hwnd), (UINT)(wParam)), 0L)
590 #define FORWARD_WM_COMPACTING(hwnd, compactRatio, fn) \
591 (void)(fn)((hwnd), WM_COMPACTING, (WPARAM)(UINT)(compactRatio), 0L)
593 /* void Cls_OnWinIniChange(HWND hwnd, LPCTSTR lpszSectionName) */
594 #define HANDLE_WM_WININICHANGE(hwnd, wParam, lParam, fn) \
595 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
596 #define FORWARD_WM_WININICHANGE(hwnd, lpszSectionName, fn) \
597 (void)(fn)((hwnd), WM_WININICHANGE, 0L, (LPARAM)(LPCTSTR)(lpszSectionName))
599 /* void Cls_OnSysColorChange(HWND hwnd) */
600 #define HANDLE_WM_SYSCOLORCHANGE(hwnd, wParam, lParam, fn) \
601 ((fn)(hwnd), 0L)
602 #define FORWARD_WM_SYSCOLORCHANGE(hwnd, fn) \
603 (void)(fn)((hwnd), WM_SYSCOLORCHANGE, 0L, 0L)
605 /* BOOL Cls_OnQueryNewPalette(HWND hwnd) */
606 #define HANDLE_WM_QUERYNEWPALETTE(hwnd, wParam, lParam, fn) \
607 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
608 #define FORWARD_WM_QUERYNEWPALETTE(hwnd, fn) \
609 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYNEWPALETTE, 0L, 0L)
611 /* void Cls_OnPaletteIsChanging(HWND hwnd, HWND hwndPaletteChange) */
612 #define HANDLE_WM_PALETTEISCHANGING(hwnd, wParam, lParam, fn) \
613 ((fn)((hwnd), (HWND)(wParam)), 0L)
614 #define FORWARD_WM_PALETTEISCHANGING(hwnd, hwndPaletteChange, fn) \
615 (void)(fn)((hwnd), WM_PALETTEISCHANGING, (WPARAM)(HWND)(hwndPaletteChange), 0L)
617 /* void Cls_OnPaletteChanged(HWND hwnd, HWND hwndPaletteChange) */
618 #define HANDLE_WM_PALETTECHANGED(hwnd, wParam, lParam, fn) \
619 ((fn)((hwnd), (HWND)(wParam)), 0L)
620 #define FORWARD_WM_PALETTECHANGED(hwnd, hwndPaletteChange, fn) \
621 (void)(fn)((hwnd), WM_PALETTECHANGED, (WPARAM)(HWND)(hwndPaletteChange), 0L)
623 /* void Cls_OnFontChange(HWND hwnd) */
624 #define HANDLE_WM_FONTCHANGE(hwnd, wParam, lParam, fn) \
625 ((fn)(hwnd), 0L)
626 #define FORWARD_WM_FONTCHANGE(hwnd, fn) \
627 (void)(fn)((hwnd), WM_FONTCHANGE, 0L, 0L)
629 /* void Cls_OnSpoolerStatus(HWND hwnd, UINT status, int cJobInQueue) */
630 #define HANDLE_WM_SPOOLERSTATUS(hwnd, wParam, lParam, fn) \
631 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam)), 0L)
632 #define FORWARD_WM_SPOOLERSTATUS(hwnd, status, cJobInQueue, fn) \
633 (void)(fn)((hwnd), WM_SPOOLERSTATUS, (WPARAM)(status), MAKELPARAM((cJobInQueue), 0))
635 /* void Cls_OnDevModeChange(HWND hwnd, LPCTSTR lpszDeviceName) */
636 #define HANDLE_WM_DEVMODECHANGE(hwnd, wParam, lParam, fn) \
637 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
638 #define FORWARD_WM_DEVMODECHANGE(hwnd, lpszDeviceName, fn) \
639 (void)(fn)((hwnd), WM_DEVMODECHANGE, 0L, (LPARAM)(LPCTSTR)(lpszDeviceName))
641 /* void Cls_OnTimeChange(HWND hwnd) */
642 #define HANDLE_WM_TIMECHANGE(hwnd, wParam, lParam, fn) \
643 ((fn)(hwnd), 0L)
644 #define FORWARD_WM_TIMECHANGE(hwnd, fn) \
645 (void)(fn)((hwnd), WM_TIMECHANGE, 0L, 0L)
647 /* void Cls_OnPower(HWND hwnd, int code) */
648 #define HANDLE_WM_POWER(hwnd, wParam, lParam, fn) \
649 ((fn)((hwnd), (int)(wParam)), 0L)
650 #define FORWARD_WM_POWER(hwnd, code, fn) \
651 (void)(fn)((hwnd), WM_POWER, (WPARAM)(int)(code), 0L)
653 /* BOOL Cls_OnQueryEndSession(HWND hwnd) */
654 #define HANDLE_WM_QUERYENDSESSION(hwnd, wParam, lParam, fn) \
655 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
656 #define FORWARD_WM_QUERYENDSESSION(hwnd, fn) \
657 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYENDSESSION, 0L, 0L)
659 /* void Cls_OnEndSession(HWND hwnd, BOOL fEnding) */
660 #define HANDLE_WM_ENDSESSION(hwnd, wParam, lParam, fn) \
661 ((fn)((hwnd), (BOOL)(wParam)), 0L)
662 #define FORWARD_WM_ENDSESSION(hwnd, fEnding, fn) \
663 (void)(fn)((hwnd), WM_ENDSESSION, (WPARAM)(BOOL)(fEnding), 0L)
665 /* void Cls_OnQuit(HWND hwnd, int exitCode) */
666 #define HANDLE_WM_QUIT(hwnd, wParam, lParam, fn) \
667 ((fn)((hwnd), (int)(wParam)), 0L)
668 #define FORWARD_WM_QUIT(hwnd, exitCode, fn) \
669 (void)(fn)((hwnd), WM_QUIT, (WPARAM)(exitCode), 0L)
671 /* This message is in Windows 3.1 only */
672 /* void Cls_OnSystemError(HWND hwnd, int errCode) */
673 #define HANDLE_WM_SYSTEMERROR(hwnd, wParam, lParam, fn) 0L
674 #define FORWARD_WM_SYSTEMERROR(hwnd, errCode, fn) 0L
676 /* BOOL Cls_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) */
677 #define HANDLE_WM_CREATE(hwnd, wParam, lParam, fn) \
678 ((fn)((hwnd), (LPCREATESTRUCT)(lParam)) ? 0L : (LRESULT)-1L)
679 #define FORWARD_WM_CREATE(hwnd, lpCreateStruct, fn) \
680 (BOOL)(DWORD)(fn)((hwnd), WM_CREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
682 /* BOOL Cls_OnNCCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) */
683 #define HANDLE_WM_NCCREATE(hwnd, wParam, lParam, fn) \
684 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPCREATESTRUCT)(lParam))
685 #define FORWARD_WM_NCCREATE(hwnd, lpCreateStruct, fn) \
686 (BOOL)(DWORD)(fn)((hwnd), WM_NCCREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
688 /* void Cls_OnDestroy(HWND hwnd) */
689 #define HANDLE_WM_DESTROY(hwnd, wParam, lParam, fn) \
690 ((fn)(hwnd), 0L)
691 #define FORWARD_WM_DESTROY(hwnd, fn) \
692 (void)(fn)((hwnd), WM_DESTROY, 0L, 0L)
694 /* void Cls_OnNCDestroy(HWND hwnd) */
695 #define HANDLE_WM_NCDESTROY(hwnd, wParam, lParam, fn) \
696 ((fn)(hwnd), 0L)
697 #define FORWARD_WM_NCDESTROY(hwnd, fn) \
698 (void)(fn)((hwnd), WM_NCDESTROY, 0L, 0L)
700 /* void Cls_OnShowWindow(HWND hwnd, BOOL fShow, UINT status) */
701 #define HANDLE_WM_SHOWWINDOW(hwnd, wParam, lParam, fn) \
702 ((fn)((hwnd), (BOOL)(wParam), (UINT)(lParam)), 0L)
703 #define FORWARD_WM_SHOWWINDOW(hwnd, fShow, status, fn) \
704 (void)(fn)((hwnd), WM_SHOWWINDOW, (WPARAM)(BOOL)(fShow), (LPARAM)(UINT)(status))
706 /* void Cls_OnSetRedraw(HWND hwnd, BOOL fRedraw) */
707 #define HANDLE_WM_SETREDRAW(hwnd, wParam, lParam, fn) \
708 ((fn)((hwnd), (BOOL)(wParam)), 0L)
709 #define FORWARD_WM_SETREDRAW(hwnd, fRedraw, fn) \
710 (void)(fn)((hwnd), WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L)
712 /* void Cls_OnEnable(HWND hwnd, BOOL fEnable) */
713 #define HANDLE_WM_ENABLE(hwnd, wParam, lParam, fn) \
714 ((fn)((hwnd), (BOOL)(wParam)), 0L)
715 #define FORWARD_WM_ENABLE(hwnd, fEnable, fn) \
716 (void)(fn)((hwnd), WM_ENABLE, (WPARAM)(BOOL)(fEnable), 0L)
718 /* void Cls_OnSetText(HWND hwnd, LPCTSTR lpszText) */
719 #define HANDLE_WM_SETTEXT(hwnd, wParam, lParam, fn) \
720 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
721 #define FORWARD_WM_SETTEXT(hwnd, lpszText, fn) \
722 (void)(fn)((hwnd), WM_SETTEXT, 0L, (LPARAM)(LPCTSTR)(lpszText))
724 /* INT Cls_OnGetText(HWND hwnd, int cchTextMax, LPTSTR lpszText) */
725 #define HANDLE_WM_GETTEXT(hwnd, wParam, lParam, fn) \
726 (LRESULT)(DWORD)(int)(fn)((hwnd), (int)(wParam), (LPTSTR)(lParam))
727 #define FORWARD_WM_GETTEXT(hwnd, cchTextMax, lpszText, fn) \
728 (int)(DWORD)(fn)((hwnd), WM_GETTEXT, (WPARAM)(int)(cchTextMax), (LPARAM)(LPTSTR)(lpszText))
730 /* INT Cls_OnGetTextLength(HWND hwnd) */
731 #define HANDLE_WM_GETTEXTLENGTH(hwnd, wParam, lParam, fn) \
732 (LRESULT)(DWORD)(int)(fn)(hwnd)
733 #define FORWARD_WM_GETTEXTLENGTH(hwnd, fn) \
734 (int)(DWORD)(fn)((hwnd), WM_GETTEXTLENGTH, 0L, 0L)
736 /* BOOL Cls_OnWindowPosChanging(HWND hwnd, LPWINDOWPOS lpwpos) */
737 #define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \
738 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam))
739 #define FORWARD_WM_WINDOWPOSCHANGING(hwnd, lpwpos, fn) \
740 (BOOL)(DWORD)(fn)((hwnd), WM_WINDOWPOSCHANGING, 0L, (LPARAM)(LPWINDOWPOS)(lpwpos))
742 /* void Cls_OnWindowPosChanged(HWND hwnd, const LPWINDOWPOS lpwpos) */
743 #define HANDLE_WM_WINDOWPOSCHANGED(hwnd, wParam, lParam, fn) \
744 ((fn)((hwnd), (const LPWINDOWPOS)(lParam)), 0L)
745 #define FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, fn) \
746 (void)(fn)((hwnd), WM_WINDOWPOSCHANGED, 0L, (LPARAM)(const LPWINDOWPOS)(lpwpos))
748 /* void Cls_OnMove(HWND hwnd, int x, int y) */
749 #define HANDLE_WM_MOVE(hwnd, wParam, lParam, fn) \
750 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
751 #define FORWARD_WM_MOVE(hwnd, x, y, fn) \
752 (void)(fn)((hwnd), WM_MOVE, 0L, MAKELPARAM((x), (y)))
754 /* void Cls_OnSize(HWND hwnd, UINT state, int cx, int cy) */
755 #define HANDLE_WM_SIZE(hwnd, wParam, lParam, fn) \
756 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
757 #define FORWARD_WM_SIZE(hwnd, state, cx, cy, fn) \
758 (void)(fn)((hwnd), WM_SIZE, (WPARAM)(UINT)(state), MAKELPARAM((cx), (cy)))
760 /* void Cls_OnClose(HWND hwnd) */
761 #define HANDLE_WM_CLOSE(hwnd, wParam, lParam, fn) \
762 ((fn)(hwnd), 0L)
763 #define FORWARD_WM_CLOSE(hwnd, fn) \
764 (void)(fn)((hwnd), WM_CLOSE, 0L, 0L)
766 /* BOOL Cls_OnQueryOpen(HWND hwnd) */
767 #define HANDLE_WM_QUERYOPEN(hwnd, wParam, lParam, fn) \
768 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
769 #define FORWARD_WM_QUERYOPEN(hwnd, fn) \
770 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYOPEN, 0L, 0L)
772 /* void Cls_OnPaint(HWND hwnd) */
773 #define HANDLE_WM_PAINT(hwnd, wParam, lParam, fn) \
774 ((fn)(hwnd), 0L)
775 #define FORWARD_WM_PAINT(hwnd, fn) \
776 (void)(fn)((hwnd), WM_PAINT, 0L, 0L)
778 /* BOOL Cls_OnEraseBkgnd(HWND hwnd, HDC hdc) */
779 #define HANDLE_WM_ERASEBKGND(hwnd, wParam, lParam, fn) \
780 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
781 #define FORWARD_WM_ERASEBKGND(hwnd, hdc, fn) \
782 (BOOL)(DWORD)(fn)((hwnd), WM_ERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
784 /* BOOL Cls_OnIconEraseBkgnd(HWND hwnd, HDC hdc) */
785 #define HANDLE_WM_ICONERASEBKGND(hwnd, wParam, lParam, fn) \
786 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
787 #define FORWARD_WM_ICONERASEBKGND(hwnd, hdc, fn) \
788 (BOOL)(DWORD)(fn)((hwnd), WM_ICONERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
790 /* void Cls_OnNCPaint(HWND hwnd, HRGN hrgn) */
791 #define HANDLE_WM_NCPAINT(hwnd, wParam, lParam, fn) \
792 ((fn)((hwnd), (HRGN)(wParam)), 0L)
793 #define FORWARD_WM_NCPAINT(hwnd, hrgn, fn) \
794 (void)(fn)((hwnd), WM_NCPAINT, (WPARAM)(HRGN)(hrgn), 0L)
796 /* UINT Cls_OnNCCalcSize(HWND hwnd, BOOL fCalcValidRects, NCCALCSIZE_PARAMS * lpcsp) */
797 #define HANDLE_WM_NCCALCSIZE(hwnd, wParam, lParam, fn) \
798 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(0), (NCCALCSIZE_PARAMS *)(lParam))
799 #define FORWARD_WM_NCCALCSIZE(hwnd, fCalcValidRects, lpcsp, fn) \
800 (UINT)(DWORD)(fn)((hwnd), WM_NCCALCSIZE, 0L, (LPARAM)(NCCALCSIZE_PARAMS *)(lpcsp))
802 /* HICON Cls_OnQueryDragIcon(HWND hwnd) */
803 #define HANDLE_WM_QUERYDRAGICON(hwnd, wParam, lParam, fn) \
804 (LRESULT)(DWORD)(UINT)(fn)(hwnd)
805 #define FORWARD_WM_QUERYDRAGICON(hwnd, fn) \
806 (HICON)(UINT)(DWORD)(fn)((hwnd), WM_QUERYDRAGICON, 0L, 0L)
808 /* void Cls_OnDropFiles(HWND hwnd, HDROP hdrop) */
809 #define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \
810 ((fn)((hwnd), (HDROP)(wParam)), 0L)
811 #define FORWARD_WM_DROPFILES(hwnd, hdrop, fn) \
812 (void)(fn)((hwnd), WM_DROPFILES, (WPARAM)(HDROP)(hdrop), 0L)
814 /* void Cls_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized) */
815 #define HANDLE_WM_ACTIVATE(hwnd, wParam, lParam, fn) \
816 ((fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (BOOL)HIWORD(wParam)), 0L)
817 #define FORWARD_WM_ACTIVATE(hwnd, state, hwndActDeact, fMinimized, fn) \
818 (void)(fn)((hwnd), WM_ACTIVATE, MAKEWPARAM((state), (fMinimized)), (LPARAM)(HWND)(hwndActDeact))
820 /* void Cls_OnActivateApp(HWND hwnd, BOOL fActivate, DWORD dwThreadId) */
821 #define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \
822 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L)
823 #define FORWARD_WM_ACTIVATEAPP(hwnd, fActivate, dwThreadId, fn) \
824 (void)(fn)((hwnd), WM_ACTIVATEAPP, (WPARAM)(BOOL)(fActivate), (LPARAM)(dwThreadId))
826 /* BOOL Cls_OnNCActivate(HWND hwnd, BOOL fActive, HWND hwndActDeact, BOOL fMinimized) */
827 #define HANDLE_WM_NCACTIVATE(hwnd, wParam, lParam, fn) \
828 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (BOOL)(wParam), 0L, 0L)
829 #define FORWARD_WM_NCACTIVATE(hwnd, fActive, hwndActDeact, fMinimized, fn) \
830 (BOOL)(DWORD)(fn)((hwnd), WM_NCACTIVATE, (WPARAM)(BOOL)(fActive), 0L)
832 /* void Cls_OnSetFocus(HWND hwnd, HWND hwndOldFocus) */
833 #define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \
834 ((fn)((hwnd), (HWND)(wParam)), 0L)
835 #define FORWARD_WM_SETFOCUS(hwnd, hwndOldFocus, fn) \
836 (void)(fn)((hwnd), WM_SETFOCUS, (WPARAM)(HWND)(hwndOldFocus), 0L)
838 /* void Cls_OnKillFocus(HWND hwnd, HWND hwndNewFocus) */
839 #define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \
840 ((fn)((hwnd), (HWND)(wParam)), 0L)
841 #define FORWARD_WM_KILLFOCUS(hwnd, hwndNewFocus, fn) \
842 (void)(fn)((hwnd), WM_KILLFOCUS, (WPARAM)(HWND)(hwndNewFocus), 0L)
844 /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
845 #define HANDLE_WM_KEYDOWN(hwnd, wParam, lParam, fn) \
846 ((fn)((hwnd), (UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
847 #define FORWARD_WM_KEYDOWN(hwnd, vk, cRepeat, flags, fn) \
848 (void)(fn)((hwnd), WM_KEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
850 /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
851 #define HANDLE_WM_KEYUP(hwnd, wParam, lParam, fn) \
852 ((fn)((hwnd), (UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
853 #define FORWARD_WM_KEYUP(hwnd, vk, cRepeat, flags, fn) \
854 (void)(fn)((hwnd), WM_KEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
856 /* void Cls_OnChar(HWND hwnd, TCHAR ch, int cRepeat) */
857 #define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \
858 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
859 #define FORWARD_WM_CHAR(hwnd, ch, cRepeat, fn) \
860 (void)(fn)((hwnd), WM_CHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat),0))
862 /* void Cls_OnDeadChar(HWND hwnd, TCHAR ch, int cRepeat) */
863 #define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \
864 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
865 #define FORWARD_WM_DEADCHAR(hwnd, ch, cRepeat, fn) \
866 (void)(fn)((hwnd), WM_DEADCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat),0))
868 /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
869 #define HANDLE_WM_SYSKEYDOWN(hwnd, wParam, lParam, fn) \
870 ((fn)((hwnd), (UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
871 #define FORWARD_WM_SYSKEYDOWN(hwnd, vk, cRepeat, flags, fn) \
872 (void)(fn)((hwnd), WM_SYSKEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
874 /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
875 #define HANDLE_WM_SYSKEYUP(hwnd, wParam, lParam, fn) \
876 ((fn)((hwnd), (UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
877 #define FORWARD_WM_SYSKEYUP(hwnd, vk, cRepeat, flags, fn) \
878 (void)(fn)((hwnd), WM_SYSKEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
880 /* void Cls_OnSysChar(HWND hwnd, TCHAR ch, int cRepeat) */
881 #define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \
882 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
883 #define FORWARD_WM_SYSCHAR(hwnd, ch, cRepeat, fn) \
884 (void)(fn)((hwnd), WM_SYSCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat), 0))
886 /* void Cls_OnSysDeadChar(HWND hwnd, TCHAR ch, int cRepeat) */
887 #define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \
888 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
889 #define FORWARD_WM_SYSDEADCHAR(hwnd, ch, cRepeat, fn) \
890 (void)(fn)((hwnd), WM_SYSDEADCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat), 0))
892 /* void Cls_OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags) */
893 #define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \
894 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
895 #define FORWARD_WM_MOUSEMOVE(hwnd, x, y, keyFlags, fn) \
896 (void)(fn)((hwnd), WM_MOUSEMOVE, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
898 /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
899 #define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \
900 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
901 #define FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
902 (void)(fn)((hwnd), (fDoubleClick) ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
904 /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
905 #define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
906 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
908 /* void Cls_OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags) */
909 #define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \
910 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
911 #define FORWARD_WM_LBUTTONUP(hwnd, x, y, keyFlags, fn) \
912 (void)(fn)((hwnd), WM_LBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
914 /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
915 #define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \
916 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
917 #define FORWARD_WM_RBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
918 (void)(fn)((hwnd), (fDoubleClick) ? WM_RBUTTONDBLCLK : WM_RBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
920 /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
921 #define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
922 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
924 /* void Cls_OnRButtonUp(HWND hwnd, int x, int y, UINT flags) */
925 #define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \
926 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
927 #define FORWARD_WM_RBUTTONUP(hwnd, x, y, keyFlags, fn) \
928 (void)(fn)((hwnd), WM_RBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
930 /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
931 #define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \
932 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
933 #define FORWARD_WM_MBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
934 (void)(fn)((hwnd), (fDoubleClick) ? WM_MBUTTONDBLCLK : WM_MBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
936 /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
937 #define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
938 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
940 /* void Cls_OnMButtonUp(HWND hwnd, int x, int y, UINT flags) */
941 #define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \
942 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
943 #define FORWARD_WM_MBUTTONUP(hwnd, x, y, keyFlags, fn) \
944 (void)(fn)((hwnd), WM_MBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
946 /* void Cls_OnNCMouseMove(HWND hwnd, int x, int y, UINT codeHitTest) */
947 #define HANDLE_WM_NCMOUSEMOVE(hwnd, wParam, lParam, fn) \
948 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
949 #define FORWARD_WM_NCMOUSEMOVE(hwnd, x, y, codeHitTest, fn) \
950 (void)(fn)((hwnd), WM_NCMOUSEMOVE, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
952 /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
953 #define HANDLE_WM_NCLBUTTONDOWN(hwnd, wParam, lParam, fn) \
954 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
955 #define FORWARD_WM_NCLBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
956 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCLBUTTONDBLCLK : WM_NCLBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
958 /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
959 #define HANDLE_WM_NCLBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
960 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
962 /* void Cls_OnNCLButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
963 #define HANDLE_WM_NCLBUTTONUP(hwnd, wParam, lParam, fn) \
964 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
965 #define FORWARD_WM_NCLBUTTONUP(hwnd, x, y, codeHitTest, fn) \
966 (void)(fn)((hwnd), WM_NCLBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
968 /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
969 #define HANDLE_WM_NCRBUTTONDOWN(hwnd, wParam, lParam, fn) \
970 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
971 #define FORWARD_WM_NCRBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
972 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCRBUTTONDBLCLK : WM_NCRBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
974 /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
975 #define HANDLE_WM_NCRBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
976 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
978 /* void Cls_OnNCRButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
979 #define HANDLE_WM_NCRBUTTONUP(hwnd, wParam, lParam, fn) \
980 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
981 #define FORWARD_WM_NCRBUTTONUP(hwnd, x, y, codeHitTest, fn) \
982 (void)(fn)((hwnd), WM_NCRBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
984 /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
985 #define HANDLE_WM_NCMBUTTONDOWN(hwnd, wParam, lParam, fn) \
986 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
987 #define FORWARD_WM_NCMBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
988 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCMBUTTONDBLCLK : WM_NCMBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
990 /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
991 #define HANDLE_WM_NCMBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
992 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
994 /* void Cls_OnNCMButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
995 #define HANDLE_WM_NCMBUTTONUP(hwnd, wParam, lParam, fn) \
996 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
997 #define FORWARD_WM_NCMBUTTONUP(hwnd, x, y, codeHitTest, fn) \
998 (void)(fn)((hwnd), WM_NCMBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
1000 /* int Cls_OnMouseActivate(HWND hwnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg) */
1001 #define HANDLE_WM_MOUSEACTIVATE(hwnd, wParam, lParam, fn) \
1002 (LRESULT)(DWORD)(int)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
1003 #define FORWARD_WM_MOUSEACTIVATE(hwnd, hwndTopLevel, codeHitTest, msg, fn) \
1004 (int)(DWORD)(fn)((hwnd), WM_MOUSEACTIVATE, (WPARAM)(HWND)(hwndTopLevel), MAKELPARAM((codeHitTest), (msg)))
1006 /* void Cls_OnCancelMode(HWND hwnd) */
1007 #define HANDLE_WM_CANCELMODE(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1008 #define FORWARD_WM_CANCELMODE(hwnd, fn) (void)(fn)((hwnd), WM_CANCELMODE, 0L, 0L)
1010 /* void Cls_OnInitMenu(HWND hwnd, HMENU hMenu) */
1011 #define HANDLE_WM_INITMENU(hwnd, wParam, lParam, fn) \
1012 ((fn)((hwnd), (HMENU)(wParam)), 0L)
1013 #define FORWARD_WM_INITMENU(hwnd, hMenu, fn) \
1014 (void)(fn)((hwnd), WM_INITMENU, (WPARAM)(HMENU)(hMenu), 0L)
1016 /* void Cls_OnMenuSelect(HWND hwnd, HMENU hmenu, int item, HMENU hmenuPopup, UINT flags) */
1017 #define HANDLE_WM_MENUSELECT(hwnd, wParam, lParam, fn) \
1018 ((fn)((hwnd), (HMENU)(lParam), \
1019 (HIWORD(wParam) & MF_POPUP) ? 0L : (int)(LOWORD(wParam)), \
1020 (HIWORD(wParam) & MF_POPUP) ? GetSubMenu((HMENU)lParam, LOWORD(wParam)) : 0L, \
1021 (UINT)(((short)HIWORD(wParam) == -1) ? 0xFFFFFFFF : HIWORD(wParam))), 0L)
1022 #define FORWARD_WM_MENUSELECT(hwnd, hmenu, item, hmenuPopup, flags, fn) \
1023 (void)(fn)((hwnd), WM_MENUSELECT, MAKEWPARAM((item), (flags)), (LPARAM)(HMENU)((hmenu) ? (hmenu) : (hmenuPopup)))
1025 /* DWORD Cls_OnMenuChar(HWND hwnd, UINT ch, UINT flags, HMENU hmenu) */
1026 #define HANDLE_WM_MENUCHAR(hwnd, wParam, lParam, fn) \
1027 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(LOWORD(wParam)), (UINT)HIWORD(wParam), (HMENU)(lParam))
1028 #define FORWARD_WM_MENUCHAR(hwnd, ch, flags, hmenu, fn) \
1029 (DWORD)(fn)((hwnd), WM_MENUCHAR, MAKEWPARAM(flags, (WORD)(ch)), (LPARAM)(HMENU)(hmenu))
1031 /* void Cls_OnHScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) */
1032 #define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \
1033 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
1034 #define FORWARD_WM_HSCROLL(hwnd, hwndCtl, code, pos, fn) \
1035 (void)(fn)((hwnd), WM_HSCROLL, MAKEWPARAM((UINT)(int)(code),(UINT)(int)(pos)), (LPARAM)(UINT)(hwndCtl))
1037 /* void Cls_OnVScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) */
1038 #define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \
1039 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
1040 #define FORWARD_WM_VSCROLL(hwnd, hwndCtl, code, pos, fn) \
1041 (void)(fn)((hwnd), WM_VSCROLL, MAKEWPARAM((UINT)(int)(code), (UINT)(int)(pos)), (LPARAM)(HWND)(hwndCtl))
1043 /* void Cls_OnCut(HWND hwnd) */
1044 #define HANDLE_WM_CUT(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1045 #define FORWARD_WM_CUT(hwnd, fn) (void)(fn)((hwnd), WM_CUT, 0L, 0L)
1047 /* void Cls_OnCopy(HWND hwnd) */
1048 #define HANDLE_WM_COPY(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1049 #define FORWARD_WM_COPY(hwnd, fn) (void)(fn)((hwnd), WM_COPY, 0L, 0L)
1051 /* void Cls_OnPaste(HWND hwnd) */
1052 #define HANDLE_WM_PASTE(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1053 #define FORWARD_WM_PASTE(hwnd, fn) (void)(fn)((hwnd), WM_PASTE, 0L, 0L)
1055 /* void Cls_OnClear(HWND hwnd) */
1056 #define HANDLE_WM_CLEAR(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1057 #define FORWARD_WM_CLEAR(hwnd, fn) (void)(fn)((hwnd), WM_CLEAR, 0L, 0L)
1059 /* void Cls_OnUndo(HWND hwnd) */
1060 #define HANDLE_WM_UNDO(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1061 #define FORWARD_WM_UNDO(hwnd, fn) (void)(fn)((hwnd), WM_UNDO, 0L, 0L)
1063 /* HANDLE Cls_OnRenderFormat(HWND hwnd, UINT fmt) */
1064 #define HANDLE_WM_RENDERFORMAT(hwnd, wParam, lParam, fn) \
1065 (LRESULT)(DWORD)(UINT)(HANDLE)(fn)((hwnd), (UINT)(wParam))
1066 #define FORWARD_WM_RENDERFORMAT(hwnd, fmt, fn) \
1067 (HANDLE)(UINT)(DWORD)(fn)((hwnd), WM_RENDERFORMAT, (WPARAM)(UINT)(fmt), 0L)
1069 /* void Cls_OnRenderAllFormats(HWND hwnd) */
1070 #define HANDLE_WM_RENDERALLFORMATS(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1071 #define FORWARD_WM_RENDERALLFORMATS(hwnd, fn) (void)(fn)((hwnd), WM_RENDERALLFORMATS, 0L, 0L)
1073 /* void Cls_OnDestroyClipboard(HWND hwnd) */
1074 #define HANDLE_WM_DESTROYCLIPBOARD(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1075 #define FORWARD_WM_DESTROYCLIPBOARD(hwnd, fn) (void)(fn)((hwnd), WM_DESTROYCLIPBOARD, 0L, 0L)
1077 /* void Cls_OnDrawClipboard(HWND hwnd) */
1078 #define HANDLE_WM_DRAWCLIPBOARD(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1079 #define FORWARD_WM_DRAWCLIPBOARD(hwnd, fn) (void)(fn)((hwnd), WM_DRAWCLIPBOARD, 0L, 0L)
1081 /* void Cls_OnPaintClipboard(HWND hwnd, HWND hwndCBViewer, const LPPAINTSTRUCT lpPaintStruct) */
1082 #define HANDLE_WM_PAINTCLIPBOARD(hwnd, wParam, lParam, fn) \
1083 ((fn)((hwnd), (HWND)(wParam), (const LPPAINTSTRUCT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
1084 #define FORWARD_WM_PAINTCLIPBOARD(hwnd, hwndCBViewer, lpPaintStruct, fn) \
1085 (void)(fn)((hwnd), WM_PAINTCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPPAINTSTRUCT)(lpPaintStruct))
1087 /* void Cls_OnSizeClipboard(HWND hwnd, HWND hwndCBViewer, const LPRECT lprc) */
1088 #define HANDLE_WM_SIZECLIPBOARD(hwnd, wParam, lParam, fn) \
1089 ((fn)((hwnd), (HWND)(wParam), (const LPRECT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
1090 #define FORWARD_WM_SIZECLIPBOARD(hwnd, hwndCBViewer, lprc, fn) \
1091 (void)(fn)((hwnd), WM_SIZECLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPRECT)(lprc))
1093 /* void Cls_OnVScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos) */
1094 #define HANDLE_WM_VSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
1095 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1096 #define FORWARD_WM_VSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
1097 (void)(fn)((hwnd), WM_VSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
1099 /* void Cls_OnHScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos) */
1100 #define HANDLE_WM_HSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
1101 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1102 #define FORWARD_WM_HSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
1103 (void)(fn)((hwnd), WM_HSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
1105 /* void Cls_OnAskCBFormatName(HWND hwnd, int cchMax, LPTSTR rgchName) */
1106 #define HANDLE_WM_ASKCBFORMATNAME(hwnd, wParam, lParam, fn) \
1107 ((fn)((hwnd), (int)(wParam), (LPTSTR)(lParam)), 0L)
1108 #define FORWARD_WM_ASKCBFORMATNAME(hwnd, cchMax, rgchName, fn) \
1109 (void)(fn)((hwnd), WM_ASKCBFORMATNAME, (WPARAM)(int)(cchMax), (LPARAM)(rgchName))
1111 /* void Cls_OnChangeCBChain(HWND hwnd, HWND hwndRemove, HWND hwndNext) */
1112 #define HANDLE_WM_CHANGECBCHAIN(hwnd, wParam, lParam, fn) \
1113 ((fn)((hwnd), (HWND)(wParam), (HWND)(lParam)), 0L)
1114 #define FORWARD_WM_CHANGECBCHAIN(hwnd, hwndRemove, hwndNext, fn) \
1115 (void)(fn)((hwnd), WM_CHANGECBCHAIN, (WPARAM)(HWND)(hwndRemove), (LPARAM)(HWND)(hwndNext))
1117 /* BOOL Cls_OnSetCursor(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg) */
1118 #define HANDLE_WM_SETCURSOR(hwnd, wParam, lParam, fn) \
1119 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
1120 #define FORWARD_WM_SETCURSOR(hwnd, hwndCursor, codeHitTest, msg, fn) \
1121 (BOOL)(DWORD)(fn)((hwnd), WM_SETCURSOR, (WPARAM)(HWND)(hwndCursor), MAKELPARAM((codeHitTest), (msg)))
1123 /* void Cls_OnSysCommand(HWND hwnd, UINT cmd, int x, int y) */
1124 #define HANDLE_WM_SYSCOMMAND(hwnd, wParam, lParam, fn) \
1125 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1126 #define FORWARD_WM_SYSCOMMAND(hwnd, cmd, x, y, fn) \
1127 (void)(fn)((hwnd), WM_SYSCOMMAND, (WPARAM)(UINT)(cmd), MAKELPARAM((x), (y)))
1129 /* HWND Cls_MDICreate(HWND hwnd, const LPMDICREATESTRUCT lpmcs) */
1130 #define HANDLE_WM_MDICREATE(hwnd, wParam, lParam, fn) \
1131 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (LPMDICREATESTRUCT)(lParam))
1132 #define FORWARD_WM_MDICREATE(hwnd, lpmcs, fn) \
1133 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDICREATE, 0L, (LPARAM)(LPMDICREATESTRUCT)(lpmcs))
1135 /* void Cls_MDIDestroy(HWND hwnd, HWND hwndDestroy) */
1136 #define HANDLE_WM_MDIDESTROY(hwnd, wParam, lParam, fn) \
1137 ((fn)((hwnd), (HWND)(wParam)), 0L)
1138 #define FORWARD_WM_MDIDESTROY(hwnd, hwndDestroy, fn) \
1139 (void)(fn)((hwnd), WM_MDIDESTROY, (WPARAM)(hwndDestroy), 0L)
1141 /* NOTE: Usable only by MDI client windows */
1142 /* void Cls_MDIActivate(HWND hwnd, BOOL fActive, HWND hwndActivate, HWND hwndDeactivate) */
1143 #define HANDLE_WM_MDIACTIVATE(hwnd, wParam, lParam, fn) \
1144 ((fn)((hwnd), (BOOL)(lParam == (LPARAM)hwnd), (HWND)(lParam), (HWND)(wParam)), 0L)
1145 #define FORWARD_WM_MDIACTIVATE(hwnd, fActive, hwndActivate, hwndDeactivate, fn) \
1146 (void)(fn)(hwnd, WM_MDIACTIVATE, (WPARAM)(hwndDeactivate), (LPARAM)(hwndActivate))
1148 /* void Cls_MDIRestore(HWND hwnd, HWND hwndRestore) */
1149 #define HANDLE_WM_MDIRESTORE(hwnd, wParam, lParam, fn) \
1150 ((fn)((hwnd), (HWND)(wParam)), 0L)
1151 #define FORWARD_WM_MDIRESTORE(hwnd, hwndRestore, fn) \
1152 (void)(fn)((hwnd), WM_MDIRESTORE, (WPARAM)(hwndRestore), 0L)
1154 /* HWND Cls_MDINext(HWND hwnd, HWND hwndCur, BOOL fPrev) */
1155 #define HANDLE_WM_MDINEXT(hwnd, wParam, lParam, fn) \
1156 (LRESULT)(HWND)(fn)((hwnd), (HWND)(wParam), (BOOL)lParam)
1157 #define FORWARD_WM_MDINEXT(hwnd, hwndCur, fPrev, fn) \
1158 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDINEXT, (WPARAM)(hwndCur), (LPARAM)(fPrev))
1160 /* void Cls_MDIMaximize(HWND hwnd, HWND hwndMaximize) */
1161 #define HANDLE_WM_MDIMAXIMIZE(hwnd, wParam, lParam, fn) \
1162 ((fn)((hwnd), (HWND)(wParam)), 0L)
1163 #define FORWARD_WM_MDIMAXIMIZE(hwnd, hwndMaximize, fn) \
1164 (void)(fn)((hwnd), WM_MDIMAXIMIZE, (WPARAM)(hwndMaximize), 0L)
1166 /* BOOL Cls_MDITile(HWND hwnd, UINT cmd) */
1167 #define HANDLE_WM_MDITILE(hwnd, wParam, lParam, fn) \
1168 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
1169 #define FORWARD_WM_MDITILE(hwnd, cmd, fn) \
1170 (BOOL)(DWORD)(fn)((hwnd), WM_MDITILE, (WPARAM)(cmd), 0L)
1172 /* BOOL Cls_MDICascade(HWND hwnd, UINT cmd) */
1173 #define HANDLE_WM_MDICASCADE(hwnd, wParam, lParam, fn) \
1174 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
1175 #define FORWARD_WM_MDICASCADE(hwnd, cmd, fn) \
1176 (BOOL)(DWORD)(fn)((hwnd), WM_MDICASCADE, (WPARAM)(cmd), 0L)
1178 /* void Cls_MDIIconArrange(HWND hwnd) */
1179 #define HANDLE_WM_MDIICONARRANGE(hwnd, wParam, lParam, fn) \
1180 ((fn)(hwnd), 0L)
1181 #define FORWARD_WM_MDIICONARRANGE(hwnd, fn) \
1182 (void)(fn)((hwnd), WM_MDIICONARRANGE, 0L, 0L)
1184 /* HWND Cls_MDIGetActive(HWND hwnd) */
1185 #define HANDLE_WM_MDIGETACTIVE(hwnd, wParam, lParam, fn) \
1186 (LRESULT)(DWORD)(UINT)(fn)(hwnd)
1187 #define FORWARD_WM_MDIGETACTIVE(hwnd, fn) \
1188 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDIGETACTIVE, 0L, 0L)
1190 /* HMENU Cls_MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) */
1191 #define HANDLE_WM_MDISETMENU(hwnd, wParam, lParam, fn) \
1192 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(wParam), (HMENU)(wParam), (HMENU)(lParam))
1193 #define FORWARD_WM_MDISETMENU(hwnd, fRefresh, hmenuFrame, hmenuWindow, fn) \
1194 (HMENU)(UINT)(DWORD)(fn)((hwnd), WM_MDISETMENU, (WPARAM)((fRefresh) ? (hmenuFrame) : 0), (LPARAM)(hmenuWindow))
1196 /* void Cls_OnChildActivate(HWND hwnd) */
1197 #define HANDLE_WM_CHILDACTIVATE(hwnd, wParam, lParam, fn) \
1198 ((fn)(hwnd), 0L)
1199 #define FORWARD_WM_CHILDACTIVATE(hwnd, fn) \
1200 (void)(fn)((hwnd), WM_CHILDACTIVATE, 0L, 0L)
1202 /* BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) */
1203 #define HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, fn) \
1204 (LRESULT)(DWORD)(UINT)(BOOL)(fn)((hwnd), (HWND)(wParam), lParam)
1205 #define FORWARD_WM_INITDIALOG(hwnd, hwndFocus, lParam, fn) \
1206 (BOOL)(DWORD)(fn)((hwnd), WM_INITDIALOG, (WPARAM)(HWND)(hwndFocus), (lParam))
1208 /* HWND Cls_OnNextDlgCtl(HWND hwnd, HWND hwndSetFocus, BOOL fNext) */
1209 #define HANDLE_WM_NEXTDLGCTL(hwnd, wParam, lParam, fn) \
1210 (LRESULT)(DWORD)(UINT)(HWND)(fn)((hwnd), (HWND)(wParam), (BOOL)(lParam))
1211 #define FORWARD_WM_NEXTDLGCTL(hwnd, hwndSetFocus, fNext, fn) \
1212 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_NEXTDLGCTL, (WPARAM)(HWND)(hwndSetFocus), (LPARAM)(fNext))
1214 /* void Cls_OnParentNotify(HWND hwnd, UINT msg, HWND hwndChild, int idChild) */
1215 #define HANDLE_WM_PARENTNOTIFY(hwnd, wParam, lParam, fn) \
1216 ((fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
1217 #define FORWARD_WM_PARENTNOTIFY(hwnd, msg, hwndChild, idChild, fn) \
1218 (void)(fn)((hwnd), WM_PARENTNOTIFY, MAKEWPARAM(msg, idChild), (LPARAM)(hwndChild))
1220 /* void Cls_OnEnterIdle(HWND hwnd, UINT source, HWND hwndSource) */
1221 #define HANDLE_WM_ENTERIDLE(hwnd, wParam, lParam, fn) \
1222 ((fn)((hwnd), (UINT)(wParam), (HWND)(lParam)), 0L)
1223 #define FORWARD_WM_ENTERIDLE(hwnd, source, hwndSource, fn) \
1224 (void)(fn)((hwnd), WM_ENTERIDLE, (WPARAM)(UINT)(source), (LPARAM)(HWND)(hwndSource))
1226 /* UINT Cls_OnGetDlgCode(HWND hwnd, LPMSG lpmsg) */
1227 #define HANDLE_WM_GETDLGCODE(hwnd, wParam, lParam, fn) \
1228 (LRESULT)(DWORD)(UINT)(fn)(hwnd, (LPMSG)(lParam))
1229 #define FORWARD_WM_GETDLGCODE(hwnd, lpmsg, fn) \
1230 (UINT)(DWORD)(fn)((hwnd), WM_GETDLGCODE, (lpmsg ? lpmsg->wParam : 0), (LPARAM)(LPMSG)(lpmsg))
1232 /* HBRUSH Cls_OnCtlColor(HWND hwnd, HDC hdc, HWND hwndChild, int type) */
1233 #define HANDLE_WM_CTLCOLORMSGBOX(hwnd, wParam, lParam, fn) \
1234 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_MSGBOX)
1235 #define FORWARD_WM_CTLCOLORMSGBOX(hwnd, hdc, hwndChild, fn) \
1236 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORMSGBOX, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1238 #define HANDLE_WM_CTLCOLOREDIT(hwnd, wParam, lParam, fn) \
1239 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_EDIT)
1240 #define FORWARD_WM_CTLCOLOREDIT(hwnd, hdc, hwndChild, fn) \
1241 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLOREDIT, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1243 #define HANDLE_WM_CTLCOLORLISTBOX(hwnd, wParam, lParam, fn) \
1244 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_LISTBOX)
1245 #define FORWARD_WM_CTLCOLORLISTBOX(hwnd, hdc, hwndChild, fn) \
1246 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORLISTBOX, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1248 #define HANDLE_WM_CTLCOLORBTN(hwnd, wParam, lParam, fn) \
1249 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_BTN)
1250 #define FORWARD_WM_CTLCOLORBTN(hwnd, hdc, hwndChild, fn) \
1251 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORBTN, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1253 #define HANDLE_WM_CTLCOLORDLG(hwnd, wParam, lParam, fn) \
1254 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_DLG)
1255 #define FORWARD_WM_CTLCOLORDLG(hwnd, hdc, hwndChild, fn) \
1256 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORDLG, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1258 #define HANDLE_WM_CTLCOLORSCROLLBAR(hwnd, wParam, lParam, fn) \
1259 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_SCROLLBAR)
1260 #define FORWARD_WM_CTLCOLORSCROLLBAR(hwnd, hdc, hwndChild, fn) \
1261 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORSCROLLBAR, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1263 #define HANDLE_WM_CTLCOLORSTATIC(hwnd, wParam, lParam, fn) \
1264 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_STATIC)
1265 #define FORWARD_WM_CTLCOLORSTATIC(hwnd, hdc, hwndChild, fn) \
1266 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORSTATIC, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1268 /* void Cls_OnDeleteItem(HWND hwnd, const DELETEITEMSTRUCT * lpDeleteItem) */
1269 #define HANDLE_WM_DELETEITEM(hwnd, wParam, lParam, fn) \
1270 ((fn)((hwnd), (const DELETEITEMSTRUCT *)(lParam)), 0L)
1271 #define FORWARD_WM_DELETEITEM(hwnd, lpDeleteItem, fn) \
1272 (void)(fn)((hwnd), WM_DELETEITEM, (WPARAM)(((const DELETEITEMSTRUCT *)(lpDeleteItem))->CtlID), (LPARAM)(const DELETEITEMSTRUCT *)(lpDeleteItem))
1274 /* int Cls_OnCompareItem(HWND hwnd, const COMPAREITEMSTRUCT * lpCompareItem) */
1275 #define HANDLE_WM_COMPAREITEM(hwnd, wParam, lParam, fn) \
1276 (LRESULT)(DWORD)(int)(fn)((hwnd), (const COMPAREITEMSTRUCT *)(lParam))
1277 #define FORWARD_WM_COMPAREITEM(hwnd, lpCompareItem, fn) \
1278 (int)(DWORD)(fn)((hwnd), WM_COMPAREITEM, (WPARAM)(((const COMPAREITEMSTRUCT *)(lpCompareItem))->CtlID), (LPARAM)(const COMPAREITEMSTRUCT *)(lpCompareItem))
1280 /* int Cls_OnVkeyToItem(HWND hwnd, UINT vk, HWND hwndListbox, int iCaret) */
1281 #define HANDLE_WM_VKEYTOITEM(hwnd, wParam, lParam, fn) \
1282 (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
1283 #define FORWARD_WM_VKEYTOITEM(hwnd, vk, hwndListBox, iCaret, fn) \
1284 (int)(DWORD)(fn)((hwnd), WM_VKEYTOITEM, MAKEWPARAM((vk), (iCaret)), (LPARAM)(hwndListBox))
1286 /* int Cls_OnCharToItem(HWND hwnd, UINT ch, HWND hwndListbox, int iCaret) */
1287 #define HANDLE_WM_CHARTOITEM(hwnd, wParam, lParam, fn) \
1288 (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
1289 #define FORWARD_WM_CHARTOITEM(hwnd, ch, hwndListBox, iCaret, fn) \
1290 (int)(DWORD)(fn)((hwnd), WM_CHARTOITEM, MAKEWPARAM((UINT)(ch), (UINT)(iCaret)), (LPARAM)(hwndListBox))
1292 /* void Cls_OnQueueSync(HWND hwnd) */
1293 #define HANDLE_WM_QUEUESYNC(hwnd, wParam, lParam, fn) \
1294 ((fn)(hwnd), 0L)
1295 #define FORWARD_WM_QUEUESYNC(hwnd, fn) \
1296 (void)(fn)((hwnd), WM_QUEUESYNC, 0L, 0L)
1297 #if (WINVER >= 0x030a)
1298 /* void Cls_OnCommNotify(HWND hwnd, int cid, UINT flags) */
1299 #define HANDLE_WM_COMMNOTIFY(hwnd, wParam, lParam, fn) \
1300 ((fn)((hwnd), (int)(wParam), (UINT)LOWORD(lParam)), 0L)
1301 #define FORWARD_WM_COMMNOTIFY(hwnd, cid, flags, fn) \
1302 (void)(fn)((hwnd), WM_COMMNOTIFY, (WPARAM)(cid), MAKELPARAM((flags), 0))
1303 #endif
1305 /* void Cls_OnDisplayChange(HWND hwnd, UINT bitsPerPixel, UINT cxScreen, UINT cyScreen) */
1306 #define HANDLE_WM_DISPLAYCHANGE(hwnd, wParam, lParam, fn) \
1307 ((fn)((hwnd), (UINT)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(wParam)), 0L)
1308 #define FORWARD_WM_DISPLAYCHANGE(hwnd, bitsPerPixel, cxScreen, cyScreen, fn) \
1309 (void)(fn)((hwnd), WM_DISPLAYCHANGE, (WPARAM)(UINT)(bitsPerPixel), (LPARAM)MAKELPARAM((UINT)(cxScreen), (UINT)(cyScreen)))
1311 /* BOOL Cls_OnDeviceChange(HWND hwnd, UINT uEvent, DWORD dwEventData) */
1312 #define HANDLE_WM_DEVICECHANGE(hwnd, wParam, lParam, fn) \
1313 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (UINT)(wParam), (DWORD)(wParam))
1314 #define FORWARD_WM_DEVICECHANGE(hwnd, uEvent, dwEventData, fn) \
1315 (BOOL)(DWORD)(fn)((hwnd), WM_DEVICECHANGE, (WPARAM)(UINT)(uEvent), (LPARAM)(DWORD)(dwEventData))
1317 /* void Cls_OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos) */
1318 #define HANDLE_WM_CONTEXTMENU(hwnd, wParam, lParam, fn) \
1319 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
1320 #define FORWARD_WM_CONTEXTMENU(hwnd, hwndContext, xPos, yPos, fn) \
1321 (void)(fn)((hwnd), WM_CONTEXTMENU, (WPARAM)(HWND)(hwndContext), MAKELPARAM((UINT)(xPos), (UINT)(yPos)))
1323 /* void Cls_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT * lpMeasureItem) */
1324 #define HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, fn) \
1325 ((fn)((hwnd), (MEASUREITEMSTRUCT *)(lParam)), 0L)
1326 #define FORWARD_WM_MEASUREITEM(hwnd, lpMeasureItem, fn) \
1327 (void)(fn)((hwnd), WM_MEASUREITEM, (WPARAM)(((MEASUREITEMSTRUCT *)lpMeasureItem)->CtlID), (LPARAM)(MEASUREITEMSTRUCT *)(lpMeasureItem))
1329 /* void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) */
1330 #define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \
1331 ((fn)((hwnd), (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
1332 #define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \
1333 (void)(fn)((hwnd), WM_COMMAND, MAKEWPARAM((UINT)(id),(UINT)(codeNotify)), (LPARAM)(HWND)(hwndCtl))
1335 /* void Cls_OnTimer(HWND hwnd, UINT id) */
1336 #define HANDLE_WM_TIMER(hwnd, wParam, lParam, fn) ((fn)((hwnd), (UINT)(wParam)), 0L)
1337 #define FORWARD_WM_TIMER(hwnd, id, fn) (void)(fn)((hwnd), WM_TIMER, (WPARAM)(UINT)(id), 0L)
1339 /* void Cls_OnInitMenuPopup(HWND hwnd, HMENU hMenu, UINT item, BOOL fSystemMenu) */
1340 #define HANDLE_WM_INITMENUPOPUP(hwnd, wParam, lParam, fn) \
1341 ((fn)((hwnd), (HMENU)(wParam), (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
1342 #define FORWARD_WM_INITMENUPOPUP(hwnd, hMenu, item, fSystemMenu, fn) \
1343 (void)(fn)((hwnd), WM_INITMENUPOPUP, (WPARAM)(HMENU)(hMenu), MAKELPARAM((item),(fSystemMenu)))
1345 /* UINT Cls_OnNCHitTest(HWND hwnd, int x, int y) */
1346 #define HANDLE_WM_NCHITTEST(hwnd, wParam, lParam, fn) \
1347 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam))
1348 #define FORWARD_WM_NCHITTEST(hwnd, x, y, fn) \
1349 (UINT)(DWORD)(fn)((hwnd), WM_NCHITTEST, 0L, MAKELPARAM((x), (y)))
1351 /* HFONT Cls_OnGetFont(HWND hwnd) */
1352 #define HANDLE_WM_GETFONT(hwnd, wParam, lParam, fn) (LRESULT)(DWORD)(UINT)(HFONT)(fn)(hwnd)
1353 #define FORWARD_WM_GETFONT(hwnd, fn) (HFONT)(UINT)(DWORD)(fn)((hwnd), WM_GETFONT, 0L, 0L)
1355 /* void Cls_OnSetFont(HWND hwndCtl, HFONT hfont, BOOL fRedraw) */
1356 #define HANDLE_WM_SETFONT(hwnd, wParam, lParam, fn) \
1357 ((fn)((hwnd), (HFONT)(wParam), (BOOL)(lParam)), 0L)
1358 #define FORWARD_WM_SETFONT(hwnd, hfont, fRedraw, fn) \
1359 (void)(fn)((hwnd), WM_SETFONT, (WPARAM)(HFONT)(hfont), (LPARAM)(BOOL)(fRedraw))
1361 /* void Cls_OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO lpMinMaxInfo) */
1362 #define HANDLE_WM_GETMINMAXINFO(hwnd, wParam, lParam, fn) \
1363 ((fn)((hwnd), (LPMINMAXINFO)(lParam)), 0L)
1364 #define FORWARD_WM_GETMINMAXINFO(hwnd, lpMinMaxInfo, fn) \
1365 (void)(fn)((hwnd), WM_GETMINMAXINFO, 0L, (LPARAM)(LPMINMAXINFO)(lpMinMaxInfo))
1367 /* void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT lpDrawItem) */
1368 #define HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, fn) \
1369 ((fn)((hwnd), (const DRAWITEMSTRUCT *)(lParam)), 0L)
1370 #define FORWARD_WM_DRAWITEM(hwnd, lpDrawItem, fn) \
1371 (void)(fn)((hwnd), WM_DRAWITEM, (WPARAM)(((const DRAWITEMSTRUCT *)lpDrawItem)->CtlID), (LPARAM)(const DRAWITEMSTRUCT *)(lpDrawItem))
1374 /****** C runtime porting macros ****************************************/
1376 #define _ncalloc calloc
1377 #define _nexpand _expand
1378 #define _ffree free
1379 #define _fmalloc malloc
1380 #define _fmemccpy _memccpy
1381 #define _fmemchr memchr
1382 #define _fmemcmp memcmp
1383 #define _fmemcpy memcpy
1384 #define _fmemicmp _memicmp
1385 #define _fmemmove memmove
1386 #define _fmemset memset
1387 #define _fmsize _msize
1388 #define _frealloc realloc
1389 #define _fstrcat strcat
1390 #define _fstrchr strchr
1391 #define _fstrcmp strcmp
1392 #define _fstrcpy strcpy
1393 #define _fstrcspn strcspn
1394 #define _fstrdup _strdup
1395 #define _fstricmp _stricmp
1396 #define _fstrlen strlen
1397 #define _fstrlwr _strlwr
1398 #define _fstrncat strncat
1399 #define _fstrncmp strncmp
1400 #define _fstrncpy strncpy
1401 #define _fstrnicmp _strnicmp
1402 #define _fstrnset _strnset
1403 #define _fstrpbrk strpbrk
1404 #define _fstrrchr strrchr
1405 #define _fstrrev _strrev
1406 #define _fstrset _strset
1407 #define _fstrspn strspn
1408 #define _fstrstr strstr
1409 #define _fstrtok strtok
1410 #define _fstrupr _strupr
1411 #define _nfree free
1412 #define _nmalloc malloc
1413 #define _nmsize _msize
1414 #define _nrealloc realloc
1415 #define _nstrdup _strdup
1416 #define hmemcpy MoveMemory
1418 #ifdef __cplusplus
1420 #endif
1422 #endif