oledlg: Added Hungarian translation.
[wine/hacks.git] / include / windowsx.h
blob6bd3a2a4d90b0e81dadacba6cceff5f3efec9633
1 /* Copyright (C) 1999 Corel Corporation (Paul Quinn)
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #ifndef _INC_WINDOWSX
19 #define _INC_WINDOWSX
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 #ifndef SNDMSG
26 #ifdef __cplusplus
27 #define SNDMSG ::SendMessage
28 #else /* __cplusplus */
29 #define SNDMSG SendMessage
30 #endif /* __cplusplus */
31 #endif /* SNDMSG */
33 #define GET_WPARAM(wp, lp) (wp)
34 #define GET_LPARAM(wp, lp) (lp)
36 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
37 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
39 #define GET_EM_LINESCROLL_MPS(vert, horz) (WPARAM)horz, (LPARAM)vert
41 #define GET_EM_SETSEL_START(wp, lp) (INT)(wp)
42 #define GET_EM_SETSEL_END(wp, lp) (lp)
43 #define GET_EM_SETSEL_MPS(iStart, iEnd) (WPARAM)(iStart), (LPARAM)(iEnd)
45 #define GET_WM_ACTIVATE_STATE(wp, lp) LOWORD(wp)
46 #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) (BOOL)HIWORD(wp)
47 #define GET_WM_ACTIVATE_HWND(wp, lp) (HWND)(lp)
48 #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) (WPARAM)MAKELONG((s), (fmin)), (LPARAM)(hwnd)
50 #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)(lp)
52 #define GET_WM_CHARTOITEM_CHAR(wp, lp) (TCHAR)LOWORD(wp)
53 #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(wp)
54 #define GET_WM_CHARTOITEM_HWND(wp, lp) (HWND)(lp)
55 #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) (WPARAM)MAKELONG((pos), (ch)), (LPARAM)(hwnd)
57 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
58 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
59 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
60 #define GET_WM_COMMAND_MPS(id, hwnd, cmd) (WPARAM)MAKELONG(id, cmd), (LPARAM)(hwnd)
62 #define WM_CTLCOLOR 0x0019
64 #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
65 #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
66 #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
67 #define GET_WM_CTLCOLOR_MSG(type) (WORD)(WM_CTLCOLORMSGBOX+(type))
68 #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) (WPARAM)(hdc), (LPARAM)(hwnd)
70 #define GET_WM_HSCROLL_CODE(wp, lp) LOWORD(wp)
71 #define GET_WM_HSCROLL_POS(wp, lp) HIWORD(wp)
72 #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)(lp)
73 #define GET_WM_HSCROLL_MPS(code, pos, hwnd) (WPARAM)MAKELONG(code, pos), (LPARAM)(hwnd)
75 #define GET_WM_MENUCHAR_CHAR(wp, lp) (TCHAR)LOWORD(wp)
76 #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)(lp)
77 #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)HIWORD(wp)
78 #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) (WPARAM)MAKELONG(ch, f), (LPARAM)(hmenu)
80 #define GET_WM_MENUSELECT_CMD(wp, lp) LOWORD(wp)
81 #define GET_WM_MENUSELECT_FLAGS(wp, lp) (UINT)(int)(short)HIWORD(wp)
82 #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)(lp)
83 #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) (WPARAM)MAKELONG(cmd, f), (LPARAM)(hmenu)
85 #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (lp == (LPARAM)hwnd)
86 #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)(wp)
87 #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)(lp)
88 #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA) (WPARAM)(hwndA), 0
89 #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) (WPARAM)hmenuF, (LPARAM)hmenuW
91 #define GET_WM_PARENTNOTIFY_MSG(wp, lp) LOWORD(wp)
92 #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(wp)
93 #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)(lp)
94 #define GET_WM_PARENTNOTIFY_X(wp, lp) (int)(short)LOWORD(lp)
95 #define GET_WM_PARENTNOTIFY_Y(wp, lp) (int)(short)HIWORD(lp)
96 #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) (WPARAM)MAKELONG(id, msg), (LPARAM)(hwnd)
97 #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) (WPARAM)MAKELONG(0, msg), MAKELONG(x, y)
99 #define GET_WM_VKEYTOITEM_CODE(wp, lp) (int)(short)LOWORD(wp)
100 #define GET_WM_VKEYTOITEM_ITEM(wp, lp) HIWORD(wp)
101 #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)(lp)
102 #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) (WPARAM)MAKELONG(item, code), (LPARAM)(hwnd)
104 #define GET_WM_VSCROLL_CODE(wp, lp) LOWORD(wp)
105 #define GET_WM_VSCROLL_POS(wp, lp) HIWORD(wp)
106 #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)(lp)
107 #define GET_WM_VSCROLL_MPS(code, pos, hwnd) (WPARAM)MAKELONG(code, pos), (LPARAM)(hwnd)
109 /****** KERNEL Macro APIs ******************************************************/
111 #define GetInstanceModule(hInst) (HMODULE)(hInst)
112 #define GlobalPtrHandle(lp) ((HGLOBAL)GlobalHandle(lp))
113 #define GlobalLockPtr(lp) ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
114 #define GlobalUnlockPtr(lp) GlobalUnlock(GlobalPtrHandle(lp))
115 #define GlobalAllocPtr(flags, cb) (GlobalLock(GlobalAlloc((flags), (cb))))
116 #define GlobalReAllocPtr(lp, cbNew, flags) (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
117 #define GlobalFreePtr(lp) (GlobalUnlockPtr(lp), (BOOL)(ULONG_PTR)GlobalFree(GlobalPtrHandle(lp)))
119 /****** USER Macro APIs ******************************************************/
121 #define GetWindowInstance(hwnd) ((HMODULE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE))
123 #define GetWindowStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_STYLE))
124 #define GetWindowExStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_EXSTYLE))
126 #define GetWindowOwner(hwnd) GetWindow(hwnd, GW_OWNER)
128 #define GetFirstChild(hwnd) GetTopWindow(hwnd)
129 #define GetFirstSibling(hwnd) GetWindow(hwnd, GW_HWNDFIRST)
130 #define GetLastSibling(hwnd) GetWindow(hwnd, GW_HWNDLAST)
131 #define GetNextSibling(hwnd) GetWindow(hwnd, GW_HWNDNEXT)
132 #define GetPrevSibling(hwnd) GetWindow(hwnd, GW_HWNDPREV)
134 #define GetWindowID(hwnd) GetDlgCtrlID(hwnd)
136 #define SetWindowRedraw(hwnd, fRedraw) \
137 ((void)SendMessage(hwnd, WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L))
138 #define SubclassWindow(hwnd, lpfn) \
139 ((WNDPROC)SetWindowLongPtr((hwnd), GWLP_WNDPROC, (LPARAM)(WNDPROC)(lpfn)))
141 #define IsMinimized(hwnd) IsIconic(hwnd)
142 #define IsMaximized(hwnd) IsZoomed(hwnd)
143 #define IsRestored(hwnd) ((GetWindowStyle(hwnd) & (WS_MINIMIZE | WS_MAXIMIZE)) == 0L)
144 #define SetWindowFont(hwnd, hfont, fRedraw) \
145 FORWARD_WM_SETFONT((hwnd), (hfont), (fRedraw), SendMessage)
147 #define GetWindowFont(hwnd) FORWARD_WM_GETFONT((hwnd), SendMessage)
149 #define MapWindowRect(hwndFrom, hwndTo, lprc) \
150 MapWindowPoints((hwndFrom), (hwndTo), (POINT *)(lprc), 2)
152 #define IsLButtonDown() (GetKeyState(VK_LBUTTON) < 0)
153 #define IsRButtonDown() (GetKeyState(VK_RBUTTON) < 0)
154 #define IsMButtonDown() (GetKeyState(VK_MBUTTON) < 0)
156 #define SetDlgMsgResult(hwnd, msg, result) (( \
157 (msg) == WM_CTLCOLORMSGBOX || \
158 (msg) == WM_CTLCOLOREDIT || \
159 (msg) == WM_CTLCOLORLISTBOX || \
160 (msg) == WM_CTLCOLORBTN || \
161 (msg) == WM_CTLCOLORDLG || \
162 (msg) == WM_CTLCOLORSCROLLBAR || \
163 (msg) == WM_CTLCOLORSTATIC || \
164 (msg) == WM_COMPAREITEM || \
165 (msg) == WM_VKEYTOITEM || \
166 (msg) == WM_CHARTOITEM || \
167 (msg) == WM_QUERYDRAGICON || \
168 (msg) == WM_INITDIALOG \
169 ) ? (BOOL)(result) : (SetWindowLongPtr((hwnd), DWLP_MSGRESULT, (LPARAM)(LRESULT)(result)), TRUE))
171 #define DefDlgProcEx(hwnd, msg, wParam, lParam, pfRecursion) \
172 (*(pfRecursion) = TRUE, DefDlgProc(hwnd, msg, wParam, lParam))
174 #define CheckDefDlgRecursion(pfRecursion) \
175 if (*(pfRecursion)) { *(pfRecursion) = FALSE; return FALSE; }
177 #define SubclassDialog(hwndDlg, lpfn) \
178 ((DLGPROC)SetWindowLongPtr(hwndDlg, DWLP_DLGPROC, (LPARAM)(DLGPROC)(lpfn)))
180 #define DeletePen(hpen) DeleteObject((HGDIOBJ)(HPEN)(hpen))
181 #define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen)))
182 #define GetStockPen(i) ((HPEN)GetStockObject(i))
184 #define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr))
185 #define SelectBrush(hdc, hbr) ((HBRUSH)SelectObject((hdc), (HGDIOBJ)(HBRUSH)(hbr)))
186 #define GetStockBrush(i) ((HBRUSH)GetStockObject(i))
188 #define DeleteRgn(hrgn) DeleteObject((HGDIOBJ)(HRGN)(hrgn))
190 #define CopyRgn(hrgnDst, hrgnSrc) CombineRgn(hrgnDst, hrgnSrc, 0, RGN_COPY)
191 #define IntersectRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND)
192 #define SubtractRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF)
193 #define UnionRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR)
194 #define XorRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR)
196 #define DeletePalette(hpal) DeleteObject((HGDIOBJ)(HPALETTE)(hpal))
198 #define DeleteFont(hfont) DeleteObject((HGDIOBJ)(HFONT)(hfont))
199 #define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT) (hfont)))
200 #define GetStockFont(i) ((HFONT)GetStockObject(i))
201 #define DeleteBitmap(hbm) DeleteObject((HGDIOBJ)(HBITMAP)(hbm))
202 #define SelectBitmap(hdc, hbm) ((HBITMAP)SelectObject((hdc), (HGDIOBJ)(HBITMAP)(hbm)))
203 #define InsetRect(lprc, dx, dy) InflateRect((lprc), -(dx), -(dy))
206 /* Button Message APIs */
208 #define Button_Enable(hwndCtl, fEnable) \
209 EnableWindow((hwndCtl), (fEnable))
211 #define Button_GetCheck(hwndCtl) \
212 ((int)SendMessage((hwndCtl), BM_GETCHECK, 0L, 0L))
214 #define Button_GetState(hwndCtl) \
215 ((int)SendMessage((hwndCtl), BM_GETSTATE, 0L, 0L))
217 #define Button_GetText(hwndCtl, lpch, cchMax) \
218 GetWindowText((hwndCtl), (lpch), (cchMax))
220 #define Button_GetTextLength(hwndCtl) \
221 GetWindowTextLength(hwndCtl)
223 #define Button_SetCheck(hwndCtl, check) \
224 ((void)SendMessage((hwndCtl), BM_SETCHECK, (WPARAM)(int)(check), 0L))
226 #define Button_SetState(hwndCtl, state) \
227 ((UINT)SendMessage((hwndCtl), BM_SETSTATE, (WPARAM)(int)(state), 0L))
229 #define Button_SetStyle(hwndCtl, style, fRedraw) \
230 ((void)SendMessage((hwndCtl), BM_SETSTYLE, (WPARAM)LOWORD(style), MAKELPARAM(((fRedraw) ? TRUE : FALSE), 0)))
232 #define Button_SetText(hwndCtl, lpsz) \
233 SetWindowText((hwndCtl), (lpsz))
236 /* ComboBox Message APIs */
238 #define ComboBox_AddItemData(hwndCtl, data) \
239 ((int)SendMessage((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(data)))
241 #define ComboBox_AddString(hwndCtl, lpsz) \
242 ((int)SendMessage((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
244 #define ComboBox_DeleteString(hwndCtl, index) \
245 ((int)SendMessage((hwndCtl), CB_DELETESTRING, (WPARAM)(int)(index), 0L))
247 #define ComboBox_Dir(hwndCtl, attrs, lpszFileSpec) \
248 ((int)SendMessage((hwndCtl), CB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCTSTR)(lpszFileSpec)))
250 #define ComboBox_Enable(hwndCtl, fEnable) \
251 EnableWindow((hwndCtl), (fEnable))
253 #define ComboBox_FindItemData(hwndCtl, indexStart, data) \
254 ((int)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
256 #define ComboBox_FindString(hwndCtl, indexStart, lpszFind) \
257 ((int)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
259 #define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind) \
260 ((int)SendMessage((hwndCtl), CB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
262 #define ComboBox_GetCount(hwndCtl) \
263 ((int)SendMessage((hwndCtl), CB_GETCOUNT, 0L, 0L))
265 #define ComboBox_GetCurSel(hwndCtl) \
266 ((int)SendMessage((hwndCtl), CB_GETCURSEL, 0L, 0L))
268 #define ComboBox_GetDroppedControlRect(hwndCtl, lprc) \
269 ((void)SendMessage((hwndCtl), CB_GETDROPPEDCONTROLRECT, 0L, (LPARAM)(RECT *)(lprc)))
271 #define ComboBox_GetDroppedState(hwndCtl) \
272 ((BOOL)SendMessage((hwndCtl), CB_GETDROPPEDSTATE, 0L, 0L))
274 #define ComboBox_GetEditSel(hwndCtl) \
275 ((DWORD)SendMessage((hwndCtl), CB_GETEDITSEL, 0L, 0L))
277 #define ComboBox_GetExtendedUI(hwndCtl) \
278 ((UINT)SendMessage((hwndCtl), CB_GETEXTENDEDUI, 0L, 0L))
280 #define ComboBox_GetItemData(hwndCtl, index) \
281 ((LRESULT)SendMessage((hwndCtl), CB_GETITEMDATA, (WPARAM)(int)(index), 0L))
283 #define ComboBox_GetItemHeight(hwndCtl) \
284 ((int)SendMessage((hwndCtl), CB_GETITEMHEIGHT, 0L, 0L))
286 #define ComboBox_GetLBText(hwndCtl, index, lpszBuffer) \
287 ((int)SendMessage((hwndCtl), CB_GETLBTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer)))
289 #define ComboBox_GetLBTextLen(hwndCtl, index) \
290 ((int)SendMessage((hwndCtl), CB_GETLBTEXTLEN, (WPARAM)(int)(index), 0L))
292 #define ComboBox_InsertItemData(hwndCtl, index, data) \
293 ((int)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(data)))
295 #define ComboBox_LimitText(hwndCtl, cchLimit) \
296 ((int)SendMessage((hwndCtl), CB_LIMITTEXT, (WPARAM)(int)(cchLimit), 0L))
298 #define ComboBox_GetText(hwndCtl, lpch, cchMax) \
299 GetWindowText((hwndCtl), (lpch), (cchMax))
301 #define ComboBox_GetTextLength(hwndCtl) \
302 GetWindowTextLength(hwndCtl)
304 #define ComboBox_InsertString(hwndCtl, index, lpsz) \
305 ((int)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpsz)))
307 #define ComboBox_LimitText(hwndCtl, cchLimit) \
308 ((int)SendMessage((hwndCtl), CB_LIMITTEXT, (WPARAM)(int)(cchLimit), 0L))
310 #define ComboBox_ResetContent(hwndCtl) \
311 ((int)SendMessage((hwndCtl), CB_RESETCONTENT, 0L, 0L))
313 #define ComboBox_SelectItemData(hwndCtl, indexStart, data) \
314 ((int)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
316 #define ComboBox_SelectString(hwndCtl, indexStart, lpszSelect) \
317 ((int)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszSelect)))
319 #define ComboBox_SetCurSel(hwndCtl, index) \
320 ((int)SendMessage((hwndCtl), CB_SETCURSEL, (WPARAM)(int)(index), 0L))
322 #define ComboBox_SetEditSel(hwndCtl, ichStart, ichEnd) \
323 ((int)SendMessage((hwndCtl), CB_SETEDITSEL, 0L, MAKELPARAM((ichStart), (ichEnd))))
325 #define ComboBox_SetExtendedUI(hwndCtl, flags) \
326 ((int)SendMessage((hwndCtl), CB_SETEXTENDEDUI, (WPARAM)(UINT)(flags), 0L))
328 #define ComboBox_SetItemData(hwndCtl, index, data) \
329 ((int)SendMessage((hwndCtl), CB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(DWORD)(data)))
331 #define ComboBox_SetItemHeight(hwndCtl, index, cyItem) \
332 ((int)SendMessage((hwndCtl), CB_SETITEMHEIGHT, (WPARAM)(int)(index), (LPARAM)(int)cyItem))
334 #define ComboBox_SetText(hwndCtl, lpsz) \
335 SetWindowText((hwndCtl), (lpsz))
337 #define ComboBox_ShowDropdown(hwndCtl, fShow) \
338 ((BOOL)SendMessage((hwndCtl), CB_SHOWDROPDOWN, (WPARAM)(BOOL)(fShow), 0L))
341 /* Edit Message APIs */
343 #define Edit_CanUndo(hwndCtl) \
344 ((BOOL)SendMessage((hwndCtl), EM_CANUNDO, 0L, 0L))
346 #define Edit_EmptyUndoBuffer(hwndCtl) \
347 ((void)SendMessage((hwndCtl), EM_EMPTYUNDOBUFFER, 0L, 0L))
349 #define Edit_Enable(hwndCtl, fEnable) \
350 EnableWindow((hwndCtl), (fEnable))
352 #define Edit_FmtLines(hwndCtl, fAddEOL) \
353 ((BOOL)SendMessage((hwndCtl), EM_FMTLINES, (WPARAM)(BOOL)(fAddEOL), 0L))
355 #define Edit_GetFirstVisibleLine(hwndCtl) \
356 ((int)SendMessage((hwndCtl), EM_GETFIRSTVISIBLELINE, 0L, 0L))
358 #define Edit_GetHandle(hwndCtl) \
359 ((HLOCAL)SendMessage((hwndCtl), EM_GETHANDLE, 0L, 0L))
361 #define Edit_GetLine(hwndCtl, line, lpch, cchMax) \
362 ((*((int *)(lpch)) = (cchMax)), ((int)SendMessage((hwndCtl), EM_GETLINE, (WPARAM)(int)(line), (LPARAM)(LPTSTR)(lpch))))
364 #define Edit_GetModify(hwndCtl) \
365 ((BOOL)SendMessage((hwndCtl), EM_GETMODIFY, 0L, 0L))
367 #define Edit_GetPasswordChar(hwndCtl) \
368 ((TCHAR)SendMessage((hwndCtl), EM_GETPASSWORDCHAR, 0L, 0L))
370 #define Edit_GetRect(hwndCtl, lprc) \
371 ((void)SendMessage((hwndCtl), EM_GETRECT, 0L, (LPARAM)(RECT *)(lprc)))
373 #define Edit_GetSel(hwndCtl) \
374 ((DWORD)SendMessage((hwndCtl), EM_GETSEL, 0L, 0L))
376 #define Edit_GetText(hwndCtl, lpch, cchMax) \
377 GetWindowText((hwndCtl), (lpch), (cchMax))
379 #define Edit_GetTextLength(hwndCtl) \
380 GetWindowTextLength(hwndCtl)
382 #define Edit_GetWordBreakProc(hwndCtl) \
383 ((EDITWORDBREAKPROC)SendMessage((hwndCtl), EM_GETWORDBREAKPROC, 0L, 0L))
385 #define Edit_LimitText(hwndCtl, cchMax) \
386 ((void)SendMessage((hwndCtl), EM_LIMITTEXT, (WPARAM)(UINT)(cchMax), 0L))
388 #define Edit_LineFromChar(hwndCtl, ich) \
389 ((int)SendMessage((hwndCtl), EM_LINEFROMCHAR, (WPARAM)(int)(ich), 0L))
391 #define Edit_LineIndex(hwndCtl, line) \
392 ((int)SendMessage((hwndCtl), EM_LINEINDEX, (WPARAM)(int)(line), 0L))
394 #define Edit_GetLineCount(hwndCtl) \
395 ((int)SendMessage((hwndCtl), EM_GETLINECOUNT, 0L, 0L))
397 #define Edit_LineLength(hwndCtl, line) \
398 ((int)SendMessage((hwndCtl), EM_LINELENGTH, (WPARAM)(int)(line), 0L))
400 #define Edit_ReplaceSel(hwndCtl, lpszReplace) \
401 ((void)SendMessage((hwndCtl), EM_REPLACESEL, 0L, (LPARAM)(LPCTSTR)(lpszReplace)))
403 #define Edit_Scroll(hwndCtl, dv, dh) \
404 ((void)SendMessage((hwndCtl), EM_LINESCROLL, (WPARAM)(int)(dh), (LPARAM)(int)(dv)))
406 #define Edit_ScrollCaret(hwndCtl) \
407 ((BOOL)SendMessage((hwndCtl), EM_SCROLLCARET, 0, 0L))
409 #define Edit_SetHandle(hwndCtl, h) \
410 ((void)SendMessage((hwndCtl), EM_SETHANDLE, (WPARAM)(UINT)(HLOCAL)(h), 0L))
412 #define Edit_SetModify(hwndCtl, fModified) \
413 ((void)SendMessage((hwndCtl), EM_SETMODIFY, (WPARAM)(UINT)(fModified), 0L))
415 #define Edit_SetPasswordChar(hwndCtl, ch) \
416 ((void)SendMessage((hwndCtl), EM_SETPASSWORDCHAR, (WPARAM)(UINT)(ch), 0L))
418 #define Edit_SetReadOnly(hwndCtl, fReadOnly) \
419 ((BOOL)SendMessage((hwndCtl), EM_SETREADONLY, (WPARAM)(BOOL)(fReadOnly), 0L))
421 #define Edit_SetRect(hwndCtl, lprc) \
422 ((void)SendMessage((hwndCtl), EM_SETRECT, 0L, (LPARAM)(const RECT *)(lprc)))
424 #define Edit_SetRectNoPaint(hwndCtl, lprc) \
425 ((void)SendMessage((hwndCtl), EM_SETRECTNP, 0L, (LPARAM)(const RECT *)(lprc)))
427 #define Edit_SetSel(hwndCtl, ichStart, ichEnd) \
428 ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd)))
430 #define Edit_SetTabStops(hwndCtl, cTabs, lpTabs) \
431 ((void)SendMessage((hwndCtl), EM_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(const int *)(lpTabs)))
433 #define Edit_SetText(hwndCtl, lpsz) \
434 SetWindowText((hwndCtl), (lpsz))
436 #define Edit_SetWordBreakProc(hwndCtl, lpfnWordBreak) \
437 ((void)SendMessage((hwndCtl), EM_SETWORDBREAKPROC, 0L, (LPARAM)(EDITWORDBREAKPROC)(lpfnWordBreak)))
439 #define Edit_Undo(hwndCtl) \
440 ((BOOL)SendMessage((hwndCtl), EM_UNDO, 0L, 0L))
443 /* ListBox Message APIs */
445 #define ListBox_AddItemData(hwndCtl, data) \
446 ((int)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(data)))
448 #define ListBox_AddString(hwndCtl, lpsz) \
449 ((int)SendMessage((hwndCtl), LB_ADDSTRING, 0L, (LPARAM)(LPCTSTR)(lpsz)))
451 #define ListBox_DeleteString(hwndCtl, index) \
452 ((int)SendMessage((hwndCtl), LB_DELETESTRING, (WPARAM)(int)(index), 0L))
454 #define ListBox_Dir(hwndCtl, attrs, lpszFileSpec) \
455 ((int)SendMessage((hwndCtl), LB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCTSTR)(lpszFileSpec)))
457 #define ListBox_Enable(hwndCtl, fEnable) \
458 EnableWindow((hwndCtl), (fEnable))
460 #define ListBox_FindItemData(hwndCtl, indexStart, data) \
461 ((int)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
463 #define ListBox_FindString(hwndCtl, indexStart, lpszFind) \
464 ((int)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
466 #define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind) \
467 ((int)SendMessage((hwndCtl), LB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
469 #define ListBox_GetCaretIndex(hwndCtl) \
470 ((int)SendMessage((hwndCtl), LB_GETCARETINDEX, 0L, 0L))
472 #define ListBox_GetCurSel(hwndCtl) \
473 ((int)SendMessage((hwndCtl), LB_GETCURSEL, 0L, 0L))
475 #define ListBox_GetCount(hwndCtl) \
476 ((int)SendMessage((hwndCtl), LB_GETCOUNT, 0L, 0L))
478 #define ListBox_GetHorizontalExtent(hwndCtl) \
479 ((int)SendMessage((hwndCtl), LB_GETHORIZONTALEXTENT, 0L, 0L))
481 #define ListBox_GetItemData(hwndCtl, index) \
482 ((LRESULT)SendMessage((hwndCtl), LB_GETITEMDATA, (WPARAM)(int)(index), 0L))
484 #define ListBox_GetItemHeight(hwndCtl, index) \
485 ((int)SendMessage((hwndCtl), LB_GETITEMHEIGHT, (WPARAM)(int)(index), 0L))
487 #define ListBox_GetItemRect(hwndCtl, index, lprc) \
488 ((int)SendMessage((hwndCtl), LB_GETITEMRECT, (WPARAM)(int)(index), (LPARAM)(RECT *)(lprc)))
490 #define ListBox_GetSel(hwndCtl, index) \
491 ((int)SendMessage((hwndCtl), LB_GETSEL, (WPARAM)(int)(index), 0L))
493 #define ListBox_GetSelCount(hwndCtl) \
494 ((int)SendMessage((hwndCtl), LB_GETSELCOUNT, 0L, 0L))
496 #define ListBox_GetSelItems(hwndCtl, cItems, lpItems) \
497 ((int)SendMessage((hwndCtl), LB_GETSELITEMS, (WPARAM)(int)(cItems), (LPARAM)(int *)(lpItems)))
499 #define ListBox_GetText(hwndCtl, index, lpszBuffer) \
500 ((int)SendMessage((hwndCtl), LB_GETTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer)))
502 #define ListBox_GetTextLen(hwndCtl, index) \
503 ((int)SendMessage((hwndCtl), LB_GETTEXTLEN, (WPARAM)(int)(index), 0L))
505 #define ListBox_GetTopIndex(hwndCtl) \
506 ((int)SendMessage((hwndCtl), LB_GETTOPINDEX, 0L, 0L))
508 #define ListBox_InsertItemData(hwndCtl, index, data) \
509 ((int)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(data)))
511 #define ListBox_InsertString(hwndCtl, index, lpsz) \
512 ((int)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpsz)))
514 #define ListBox_ResetContent(hwndCtl) \
515 ((BOOL)SendMessage((hwndCtl), LB_RESETCONTENT, 0L, 0L))
517 #define ListBox_SelectItemData(hwndCtl, indexStart, data) \
518 ((int)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(data)))
520 #define ListBox_SelectString(hwndCtl, indexStart, lpszFind) \
521 ((int)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCTSTR)(lpszFind)))
523 #define ListBox_SelItemRange(hwndCtl, fSelect, first, last) \
524 ((int)SendMessage((hwndCtl), LB_SELITEMRANGE, (WPARAM)(BOOL)(fSelect), MAKELPARAM((first), (last))))
526 #define ListBox_SetCaretIndex(hwndCtl, index) \
527 ((int)SendMessage((hwndCtl), LB_SETCARETINDEX, (WPARAM)(int)(index), 0L))
529 #define ListBox_SetColumnWidth(hwndCtl, cxColumn) \
530 ((void)SendMessage((hwndCtl), LB_SETCOLUMNWIDTH, (WPARAM)(int)(cxColumn), 0L))
532 #define ListBox_SetCurSel(hwndCtl, index) \
533 ((int)SendMessage((hwndCtl), LB_SETCURSEL, (WPARAM)(int)(index), 0L))
535 #define ListBox_SetHorizontalExtent(hwndCtl, cxExtent) \
536 ((void)SendMessage((hwndCtl), LB_SETHORIZONTALEXTENT, (WPARAM)(int)(cxExtent), 0L))
538 #define ListBox_SetItemData(hwndCtl, index, data) \
539 ((int)SendMessage((hwndCtl), LB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(DWORD)(data)))
541 #define ListBox_SetItemHeight(hwndCtl, index, cy) \
542 ((int)SendMessage((hwndCtl), LB_SETITEMHEIGHT, (WPARAM)(int)(index), MAKELPARAM((cy), 0)))
544 #define ListBox_SetSel(hwndCtl, fSelect, index) \
545 ((int)SendMessage((hwndCtl), LB_SETSEL, (WPARAM)(BOOL)(fSelect), (LPARAM)(UINT)(index)))
547 #define ListBox_SetTabStops(hwndCtl, cTabs, lpTabs) \
548 ((BOOL)SendMessage((hwndCtl), LB_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(int *)(lpTabs)))
550 #define ListBox_SetTopIndex(hwndCtl, indexTop) \
551 ((int)SendMessage((hwndCtl), LB_SETTOPINDEX, (WPARAM)(int)(indexTop), 0L))
554 /* Scrollbar Message APIs */
556 #define ScrollBar_Enable(hwndCtl, flags) \
557 EnableScrollBar((hwndCtl), SB_CTL, (flags))
559 #define ScrollBar_GetPos(hwndCtl) \
560 GetScrollPos((hwndCtl), SB_CTL)
562 #define ScrollBar_GetRange(hwndCtl, lpposMin, lpposMax) \
563 GetScrollRange((hwndCtl), SB_CTL, (lpposMin), (lpposMax))
565 #define ScrollBar_SetPos(hwndCtl, pos, fRedraw) \
566 SetScrollPos((hwndCtl), SB_CTL, (pos), (fRedraw))
568 #define ScrollBar_SetRange(hwndCtl, posMin, posMax, fRedraw) \
569 SetScrollRange((hwndCtl), SB_CTL, (posMin), (posMax), (fRedraw))
571 #define ScrollBar_Show(hwndCtl, fShow) \
572 ShowWindow((hwndCtl), (fShow) ? SW_SHOWNORMAL : SW_HIDE)
575 /* Static Message APIs */
577 #define Static_Enable(hwndCtl, fEnable) \
578 EnableWindow((hwndCtl), (fEnable))
580 #define Static_GetIcon(hwndCtl, hIcon) \
581 ((HICON)SendMessage((hwndCtl), STM_GETICON, 0L, 0L))
583 #define Static_GetText(hwndCtl, lpch, cchMax) \
584 GetWindowText((hwndCtl), (lpch), (cchMax))
586 #define Static_GetTextLength(hwndCtl) \
587 GetWindowTextLength(hwndCtl)
589 #define Static_SetIcon(hwndCtl, hIcon) \
590 ((HICON)SendMessage((hwndCtl), STM_SETICON, (WPARAM)(HICON)(hIcon), 0L))
592 #define Static_SetText(hwndCtl, lpsz) \
593 SetWindowText((hwndCtl), (lpsz))
596 /****** Message crackers ****************************************************/
598 #define HANDLE_MSG(hwnd, message, fn) \
599 case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
601 /* void Cls_OnCompacting(HWND hwnd, UINT compactRatio) */
602 #define HANDLE_WM_COMPACTING(hwnd, wParam, lParam, fn) \
603 ((fn)((hwnd), (UINT)(wParam)), 0L)
604 #define FORWARD_WM_COMPACTING(hwnd, compactRatio, fn) \
605 (void)(fn)((hwnd), WM_COMPACTING, (WPARAM)(UINT)(compactRatio), 0L)
607 /* void Cls_OnWinIniChange(HWND hwnd, LPCTSTR lpszSectionName) */
608 #define HANDLE_WM_WININICHANGE(hwnd, wParam, lParam, fn) \
609 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
610 #define FORWARD_WM_WININICHANGE(hwnd, lpszSectionName, fn) \
611 (void)(fn)((hwnd), WM_WININICHANGE, 0L, (LPARAM)(LPCTSTR)(lpszSectionName))
613 /* void Cls_OnSysColorChange(HWND hwnd) */
614 #define HANDLE_WM_SYSCOLORCHANGE(hwnd, wParam, lParam, fn) \
615 ((fn)(hwnd), 0L)
616 #define FORWARD_WM_SYSCOLORCHANGE(hwnd, fn) \
617 (void)(fn)((hwnd), WM_SYSCOLORCHANGE, 0L, 0L)
619 /* BOOL Cls_OnQueryNewPalette(HWND hwnd) */
620 #define HANDLE_WM_QUERYNEWPALETTE(hwnd, wParam, lParam, fn) \
621 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
622 #define FORWARD_WM_QUERYNEWPALETTE(hwnd, fn) \
623 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYNEWPALETTE, 0L, 0L)
625 /* void Cls_OnPaletteIsChanging(HWND hwnd, HWND hwndPaletteChange) */
626 #define HANDLE_WM_PALETTEISCHANGING(hwnd, wParam, lParam, fn) \
627 ((fn)((hwnd), (HWND)(wParam)), 0L)
628 #define FORWARD_WM_PALETTEISCHANGING(hwnd, hwndPaletteChange, fn) \
629 (void)(fn)((hwnd), WM_PALETTEISCHANGING, (WPARAM)(HWND)(hwndPaletteChange), 0L)
631 /* void Cls_OnPaletteChanged(HWND hwnd, HWND hwndPaletteChange) */
632 #define HANDLE_WM_PALETTECHANGED(hwnd, wParam, lParam, fn) \
633 ((fn)((hwnd), (HWND)(wParam)), 0L)
634 #define FORWARD_WM_PALETTECHANGED(hwnd, hwndPaletteChange, fn) \
635 (void)(fn)((hwnd), WM_PALETTECHANGED, (WPARAM)(HWND)(hwndPaletteChange), 0L)
637 /* void Cls_OnFontChange(HWND hwnd) */
638 #define HANDLE_WM_FONTCHANGE(hwnd, wParam, lParam, fn) \
639 ((fn)(hwnd), 0L)
640 #define FORWARD_WM_FONTCHANGE(hwnd, fn) \
641 (void)(fn)((hwnd), WM_FONTCHANGE, 0L, 0L)
643 /* void Cls_OnSpoolerStatus(HWND hwnd, UINT status, int cJobInQueue) */
644 #define HANDLE_WM_SPOOLERSTATUS(hwnd, wParam, lParam, fn) \
645 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam)), 0L)
646 #define FORWARD_WM_SPOOLERSTATUS(hwnd, status, cJobInQueue, fn) \
647 (void)(fn)((hwnd), WM_SPOOLERSTATUS, (WPARAM)(status), MAKELPARAM((cJobInQueue), 0))
649 /* void Cls_OnDevModeChange(HWND hwnd, LPCTSTR lpszDeviceName) */
650 #define HANDLE_WM_DEVMODECHANGE(hwnd, wParam, lParam, fn) \
651 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
652 #define FORWARD_WM_DEVMODECHANGE(hwnd, lpszDeviceName, fn) \
653 (void)(fn)((hwnd), WM_DEVMODECHANGE, 0L, (LPARAM)(LPCTSTR)(lpszDeviceName))
655 /* void Cls_OnTimeChange(HWND hwnd) */
656 #define HANDLE_WM_TIMECHANGE(hwnd, wParam, lParam, fn) \
657 ((fn)(hwnd), 0L)
658 #define FORWARD_WM_TIMECHANGE(hwnd, fn) \
659 (void)(fn)((hwnd), WM_TIMECHANGE, 0L, 0L)
661 /* void Cls_OnPower(HWND hwnd, int code) */
662 #define HANDLE_WM_POWER(hwnd, wParam, lParam, fn) \
663 ((fn)((hwnd), (int)(wParam)), 0L)
664 #define FORWARD_WM_POWER(hwnd, code, fn) \
665 (void)(fn)((hwnd), WM_POWER, (WPARAM)(int)(code), 0L)
667 /* BOOL Cls_OnQueryEndSession(HWND hwnd) */
668 #define HANDLE_WM_QUERYENDSESSION(hwnd, wParam, lParam, fn) \
669 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
670 #define FORWARD_WM_QUERYENDSESSION(hwnd, fn) \
671 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYENDSESSION, 0L, 0L)
673 /* void Cls_OnEndSession(HWND hwnd, BOOL fEnding) */
674 #define HANDLE_WM_ENDSESSION(hwnd, wParam, lParam, fn) \
675 ((fn)((hwnd), (BOOL)(wParam)), 0L)
676 #define FORWARD_WM_ENDSESSION(hwnd, fEnding, fn) \
677 (void)(fn)((hwnd), WM_ENDSESSION, (WPARAM)(BOOL)(fEnding), 0L)
679 /* void Cls_OnQuit(HWND hwnd, int exitCode) */
680 #define HANDLE_WM_QUIT(hwnd, wParam, lParam, fn) \
681 ((fn)((hwnd), (int)(wParam)), 0L)
682 #define FORWARD_WM_QUIT(hwnd, exitCode, fn) \
683 (void)(fn)((hwnd), WM_QUIT, (WPARAM)(exitCode), 0L)
685 /* This message is in Windows 3.1 only */
686 /* void Cls_OnSystemError(HWND hwnd, int errCode) */
687 #define HANDLE_WM_SYSTEMERROR(hwnd, wParam, lParam, fn) 0L
688 #define FORWARD_WM_SYSTEMERROR(hwnd, errCode, fn) 0L
690 /* BOOL Cls_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) */
691 #define HANDLE_WM_CREATE(hwnd, wParam, lParam, fn) \
692 ((fn)((hwnd), (LPCREATESTRUCT)(lParam)) ? 0L : (LRESULT)-1L)
693 #define FORWARD_WM_CREATE(hwnd, lpCreateStruct, fn) \
694 (BOOL)(DWORD)(fn)((hwnd), WM_CREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
696 /* BOOL Cls_OnNCCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) */
697 #define HANDLE_WM_NCCREATE(hwnd, wParam, lParam, fn) \
698 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPCREATESTRUCT)(lParam))
699 #define FORWARD_WM_NCCREATE(hwnd, lpCreateStruct, fn) \
700 (BOOL)(DWORD)(fn)((hwnd), WM_NCCREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
702 /* void Cls_OnDestroy(HWND hwnd) */
703 #define HANDLE_WM_DESTROY(hwnd, wParam, lParam, fn) \
704 ((fn)(hwnd), 0L)
705 #define FORWARD_WM_DESTROY(hwnd, fn) \
706 (void)(fn)((hwnd), WM_DESTROY, 0L, 0L)
708 /* void Cls_OnNCDestroy(HWND hwnd) */
709 #define HANDLE_WM_NCDESTROY(hwnd, wParam, lParam, fn) \
710 ((fn)(hwnd), 0L)
711 #define FORWARD_WM_NCDESTROY(hwnd, fn) \
712 (void)(fn)((hwnd), WM_NCDESTROY, 0L, 0L)
714 /* void Cls_OnShowWindow(HWND hwnd, BOOL fShow, UINT status) */
715 #define HANDLE_WM_SHOWWINDOW(hwnd, wParam, lParam, fn) \
716 ((fn)((hwnd), (BOOL)(wParam), (UINT)(lParam)), 0L)
717 #define FORWARD_WM_SHOWWINDOW(hwnd, fShow, status, fn) \
718 (void)(fn)((hwnd), WM_SHOWWINDOW, (WPARAM)(BOOL)(fShow), (LPARAM)(UINT)(status))
720 /* void Cls_OnSetRedraw(HWND hwnd, BOOL fRedraw) */
721 #define HANDLE_WM_SETREDRAW(hwnd, wParam, lParam, fn) \
722 ((fn)((hwnd), (BOOL)(wParam)), 0L)
723 #define FORWARD_WM_SETREDRAW(hwnd, fRedraw, fn) \
724 (void)(fn)((hwnd), WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L)
726 /* void Cls_OnEnable(HWND hwnd, BOOL fEnable) */
727 #define HANDLE_WM_ENABLE(hwnd, wParam, lParam, fn) \
728 ((fn)((hwnd), (BOOL)(wParam)), 0L)
729 #define FORWARD_WM_ENABLE(hwnd, fEnable, fn) \
730 (void)(fn)((hwnd), WM_ENABLE, (WPARAM)(BOOL)(fEnable), 0L)
732 /* void Cls_OnSetText(HWND hwnd, LPCTSTR lpszText) */
733 #define HANDLE_WM_SETTEXT(hwnd, wParam, lParam, fn) \
734 ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
735 #define FORWARD_WM_SETTEXT(hwnd, lpszText, fn) \
736 (void)(fn)((hwnd), WM_SETTEXT, 0L, (LPARAM)(LPCTSTR)(lpszText))
738 /* INT Cls_OnGetText(HWND hwnd, int cchTextMax, LPTSTR lpszText) */
739 #define HANDLE_WM_GETTEXT(hwnd, wParam, lParam, fn) \
740 (LRESULT)(DWORD)(int)(fn)((hwnd), (int)(wParam), (LPTSTR)(lParam))
741 #define FORWARD_WM_GETTEXT(hwnd, cchTextMax, lpszText, fn) \
742 (int)(DWORD)(fn)((hwnd), WM_GETTEXT, (WPARAM)(int)(cchTextMax), (LPARAM)(LPTSTR)(lpszText))
744 /* INT Cls_OnGetTextLength(HWND hwnd) */
745 #define HANDLE_WM_GETTEXTLENGTH(hwnd, wParam, lParam, fn) \
746 (LRESULT)(DWORD)(int)(fn)(hwnd)
747 #define FORWARD_WM_GETTEXTLENGTH(hwnd, fn) \
748 (int)(DWORD)(fn)((hwnd), WM_GETTEXTLENGTH, 0L, 0L)
750 /* BOOL Cls_OnWindowPosChanging(HWND hwnd, LPWINDOWPOS lpwpos) */
751 #define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \
752 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam))
753 #define FORWARD_WM_WINDOWPOSCHANGING(hwnd, lpwpos, fn) \
754 (BOOL)(DWORD)(fn)((hwnd), WM_WINDOWPOSCHANGING, 0L, (LPARAM)(LPWINDOWPOS)(lpwpos))
756 /* void Cls_OnWindowPosChanged(HWND hwnd, const LPWINDOWPOS lpwpos) */
757 #define HANDLE_WM_WINDOWPOSCHANGED(hwnd, wParam, lParam, fn) \
758 ((fn)((hwnd), (const LPWINDOWPOS)(lParam)), 0L)
759 #define FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, fn) \
760 (void)(fn)((hwnd), WM_WINDOWPOSCHANGED, 0L, (LPARAM)(const LPWINDOWPOS)(lpwpos))
762 /* void Cls_OnMove(HWND hwnd, int x, int y) */
763 #define HANDLE_WM_MOVE(hwnd, wParam, lParam, fn) \
764 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
765 #define FORWARD_WM_MOVE(hwnd, x, y, fn) \
766 (void)(fn)((hwnd), WM_MOVE, 0L, MAKELPARAM((x), (y)))
768 /* void Cls_OnSize(HWND hwnd, UINT state, int cx, int cy) */
769 #define HANDLE_WM_SIZE(hwnd, wParam, lParam, fn) \
770 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
771 #define FORWARD_WM_SIZE(hwnd, state, cx, cy, fn) \
772 (void)(fn)((hwnd), WM_SIZE, (WPARAM)(UINT)(state), MAKELPARAM((cx), (cy)))
774 /* void Cls_OnClose(HWND hwnd) */
775 #define HANDLE_WM_CLOSE(hwnd, wParam, lParam, fn) \
776 ((fn)(hwnd), 0L)
777 #define FORWARD_WM_CLOSE(hwnd, fn) \
778 (void)(fn)((hwnd), WM_CLOSE, 0L, 0L)
780 /* BOOL Cls_OnQueryOpen(HWND hwnd) */
781 #define HANDLE_WM_QUERYOPEN(hwnd, wParam, lParam, fn) \
782 MAKELRESULT((BOOL)(fn)(hwnd), 0L)
783 #define FORWARD_WM_QUERYOPEN(hwnd, fn) \
784 (BOOL)(DWORD)(fn)((hwnd), WM_QUERYOPEN, 0L, 0L)
786 /* void Cls_OnPaint(HWND hwnd) */
787 #define HANDLE_WM_PAINT(hwnd, wParam, lParam, fn) \
788 ((fn)(hwnd), 0L)
789 #define FORWARD_WM_PAINT(hwnd, fn) \
790 (void)(fn)((hwnd), WM_PAINT, 0L, 0L)
792 /* BOOL Cls_OnEraseBkgnd(HWND hwnd, HDC hdc) */
793 #define HANDLE_WM_ERASEBKGND(hwnd, wParam, lParam, fn) \
794 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
795 #define FORWARD_WM_ERASEBKGND(hwnd, hdc, fn) \
796 (BOOL)(DWORD)(fn)((hwnd), WM_ERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
798 /* BOOL Cls_OnIconEraseBkgnd(HWND hwnd, HDC hdc) */
799 #define HANDLE_WM_ICONERASEBKGND(hwnd, wParam, lParam, fn) \
800 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
801 #define FORWARD_WM_ICONERASEBKGND(hwnd, hdc, fn) \
802 (BOOL)(DWORD)(fn)((hwnd), WM_ICONERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
804 /* void Cls_OnNCPaint(HWND hwnd, HRGN hrgn) */
805 #define HANDLE_WM_NCPAINT(hwnd, wParam, lParam, fn) \
806 ((fn)((hwnd), (HRGN)(wParam)), 0L)
807 #define FORWARD_WM_NCPAINT(hwnd, hrgn, fn) \
808 (void)(fn)((hwnd), WM_NCPAINT, (WPARAM)(HRGN)(hrgn), 0L)
810 /* UINT Cls_OnNCCalcSize(HWND hwnd, BOOL fCalcValidRects, NCCALCSIZE_PARAMS * lpcsp) */
811 #define HANDLE_WM_NCCALCSIZE(hwnd, wParam, lParam, fn) \
812 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(0), (NCCALCSIZE_PARAMS *)(lParam))
813 #define FORWARD_WM_NCCALCSIZE(hwnd, fCalcValidRects, lpcsp, fn) \
814 (UINT)(DWORD)(fn)((hwnd), WM_NCCALCSIZE, 0L, (LPARAM)(NCCALCSIZE_PARAMS *)(lpcsp))
816 /* HICON Cls_OnQueryDragIcon(HWND hwnd) */
817 #define HANDLE_WM_QUERYDRAGICON(hwnd, wParam, lParam, fn) \
818 (LRESULT)(DWORD)(UINT)(fn)(hwnd)
819 #define FORWARD_WM_QUERYDRAGICON(hwnd, fn) \
820 (HICON)(UINT)(DWORD)(fn)((hwnd), WM_QUERYDRAGICON, 0L, 0L)
822 /* void Cls_OnDropFiles(HWND hwnd, HDROP hdrop) */
823 #define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \
824 ((fn)((hwnd), (HDROP)(wParam)), 0L)
825 #define FORWARD_WM_DROPFILES(hwnd, hdrop, fn) \
826 (void)(fn)((hwnd), WM_DROPFILES, (WPARAM)(HDROP)(hdrop), 0L)
828 /* void Cls_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized) */
829 #define HANDLE_WM_ACTIVATE(hwnd, wParam, lParam, fn) \
830 ((fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (BOOL)HIWORD(wParam)), 0L)
831 #define FORWARD_WM_ACTIVATE(hwnd, state, hwndActDeact, fMinimized, fn) \
832 (void)(fn)((hwnd), WM_ACTIVATE, MAKEWPARAM((state), (fMinimized)), (LPARAM)(HWND)(hwndActDeact))
834 /* void Cls_OnActivateApp(HWND hwnd, BOOL fActivate, DWORD dwThreadId) */
835 #define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \
836 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L)
837 #define FORWARD_WM_ACTIVATEAPP(hwnd, fActivate, dwThreadId, fn) \
838 (void)(fn)((hwnd), WM_ACTIVATEAPP, (WPARAM)(BOOL)(fActivate), (LPARAM)(dwThreadId))
840 /* BOOL Cls_OnNCActivate(HWND hwnd, BOOL fActive, HWND hwndActDeact, BOOL fMinimized) */
841 #define HANDLE_WM_NCACTIVATE(hwnd, wParam, lParam, fn) \
842 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (BOOL)(wParam), 0L, 0L)
843 #define FORWARD_WM_NCACTIVATE(hwnd, fActive, hwndActDeact, fMinimized, fn) \
844 (BOOL)(DWORD)(fn)((hwnd), WM_NCACTIVATE, (WPARAM)(BOOL)(fActive), 0L)
846 /* void Cls_OnSetFocus(HWND hwnd, HWND hwndOldFocus) */
847 #define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \
848 ((fn)((hwnd), (HWND)(wParam)), 0L)
849 #define FORWARD_WM_SETFOCUS(hwnd, hwndOldFocus, fn) \
850 (void)(fn)((hwnd), WM_SETFOCUS, (WPARAM)(HWND)(hwndOldFocus), 0L)
852 /* void Cls_OnKillFocus(HWND hwnd, HWND hwndNewFocus) */
853 #define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \
854 ((fn)((hwnd), (HWND)(wParam)), 0L)
855 #define FORWARD_WM_KILLFOCUS(hwnd, hwndNewFocus, fn) \
856 (void)(fn)((hwnd), WM_KILLFOCUS, (WPARAM)(HWND)(hwndNewFocus), 0L)
858 /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
859 #define HANDLE_WM_KEYDOWN(hwnd, wParam, lParam, fn) \
860 ((fn)((hwnd), (UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
861 #define FORWARD_WM_KEYDOWN(hwnd, vk, cRepeat, flags, fn) \
862 (void)(fn)((hwnd), WM_KEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
864 /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
865 #define HANDLE_WM_KEYUP(hwnd, wParam, lParam, fn) \
866 ((fn)((hwnd), (UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
867 #define FORWARD_WM_KEYUP(hwnd, vk, cRepeat, flags, fn) \
868 (void)(fn)((hwnd), WM_KEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
870 /* void Cls_OnChar(HWND hwnd, TCHAR ch, int cRepeat) */
871 #define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \
872 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
873 #define FORWARD_WM_CHAR(hwnd, ch, cRepeat, fn) \
874 (void)(fn)((hwnd), WM_CHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat),0))
876 /* void Cls_OnDeadChar(HWND hwnd, TCHAR ch, int cRepeat) */
877 #define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \
878 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
879 #define FORWARD_WM_DEADCHAR(hwnd, ch, cRepeat, fn) \
880 (void)(fn)((hwnd), WM_DEADCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat),0))
882 /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
883 #define HANDLE_WM_SYSKEYDOWN(hwnd, wParam, lParam, fn) \
884 ((fn)((hwnd), (UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
885 #define FORWARD_WM_SYSKEYDOWN(hwnd, vk, cRepeat, flags, fn) \
886 (void)(fn)((hwnd), WM_SYSKEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
888 /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) */
889 #define HANDLE_WM_SYSKEYUP(hwnd, wParam, lParam, fn) \
890 ((fn)((hwnd), (UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
891 #define FORWARD_WM_SYSKEYUP(hwnd, vk, cRepeat, flags, fn) \
892 (void)(fn)((hwnd), WM_SYSKEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((cRepeat), (flags)))
894 /* void Cls_OnSysChar(HWND hwnd, TCHAR ch, int cRepeat) */
895 #define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \
896 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
897 #define FORWARD_WM_SYSCHAR(hwnd, ch, cRepeat, fn) \
898 (void)(fn)((hwnd), WM_SYSCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat), 0))
900 /* void Cls_OnSysDeadChar(HWND hwnd, TCHAR ch, int cRepeat) */
901 #define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \
902 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
903 #define FORWARD_WM_SYSDEADCHAR(hwnd, ch, cRepeat, fn) \
904 (void)(fn)((hwnd), WM_SYSDEADCHAR, (WPARAM)(TCHAR)(ch), MAKELPARAM((cRepeat), 0))
906 /* void Cls_OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags) */
907 #define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \
908 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
909 #define FORWARD_WM_MOUSEMOVE(hwnd, x, y, keyFlags, fn) \
910 (void)(fn)((hwnd), WM_MOUSEMOVE, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
912 /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
913 #define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \
914 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
915 #define FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
916 (void)(fn)((hwnd), (fDoubleClick) ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
918 /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
919 #define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
920 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
922 /* void Cls_OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags) */
923 #define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \
924 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
925 #define FORWARD_WM_LBUTTONUP(hwnd, x, y, keyFlags, fn) \
926 (void)(fn)((hwnd), WM_LBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
928 /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
929 #define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \
930 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
931 #define FORWARD_WM_RBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
932 (void)(fn)((hwnd), (fDoubleClick) ? WM_RBUTTONDBLCLK : WM_RBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
934 /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
935 #define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
936 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
938 /* void Cls_OnRButtonUp(HWND hwnd, int x, int y, UINT flags) */
939 #define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \
940 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
941 #define FORWARD_WM_RBUTTONUP(hwnd, x, y, keyFlags, fn) \
942 (void)(fn)((hwnd), WM_RBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
944 /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
945 #define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \
946 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
947 #define FORWARD_WM_MBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
948 (void)(fn)((hwnd), (fDoubleClick) ? WM_MBUTTONDBLCLK : WM_MBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
950 /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) */
951 #define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
952 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
954 /* void Cls_OnMButtonUp(HWND hwnd, int x, int y, UINT flags) */
955 #define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \
956 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
957 #define FORWARD_WM_MBUTTONUP(hwnd, x, y, keyFlags, fn) \
958 (void)(fn)((hwnd), WM_MBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
960 /* void Cls_OnNCMouseMove(HWND hwnd, int x, int y, UINT codeHitTest) */
961 #define HANDLE_WM_NCMOUSEMOVE(hwnd, wParam, lParam, fn) \
962 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
963 #define FORWARD_WM_NCMOUSEMOVE(hwnd, x, y, codeHitTest, fn) \
964 (void)(fn)((hwnd), WM_NCMOUSEMOVE, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
966 /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
967 #define HANDLE_WM_NCLBUTTONDOWN(hwnd, wParam, lParam, fn) \
968 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
969 #define FORWARD_WM_NCLBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
970 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCLBUTTONDBLCLK : WM_NCLBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
972 /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
973 #define HANDLE_WM_NCLBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
974 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
976 /* void Cls_OnNCLButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
977 #define HANDLE_WM_NCLBUTTONUP(hwnd, wParam, lParam, fn) \
978 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
979 #define FORWARD_WM_NCLBUTTONUP(hwnd, x, y, codeHitTest, fn) \
980 (void)(fn)((hwnd), WM_NCLBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
982 /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
983 #define HANDLE_WM_NCRBUTTONDOWN(hwnd, wParam, lParam, fn) \
984 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
985 #define FORWARD_WM_NCRBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
986 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCRBUTTONDBLCLK : WM_NCRBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
988 /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
989 #define HANDLE_WM_NCRBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
990 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
992 /* void Cls_OnNCRButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
993 #define HANDLE_WM_NCRBUTTONUP(hwnd, wParam, lParam, fn) \
994 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
995 #define FORWARD_WM_NCRBUTTONUP(hwnd, x, y, codeHitTest, fn) \
996 (void)(fn)((hwnd), WM_NCRBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
998 /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
999 #define HANDLE_WM_NCMBUTTONDOWN(hwnd, wParam, lParam, fn) \
1000 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
1001 #define FORWARD_WM_NCMBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
1002 (void)(fn)((hwnd), (fDoubleClick) ? WM_NCMBUTTONDBLCLK : WM_NCMBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
1004 /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
1005 #define HANDLE_WM_NCMBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
1006 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
1008 /* void Cls_OnNCMButtonUp(HWND hwnd, int x, int y, UINT codeHitTest) */
1009 #define HANDLE_WM_NCMBUTTONUP(hwnd, wParam, lParam, fn) \
1010 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
1011 #define FORWARD_WM_NCMBUTTONUP(hwnd, x, y, codeHitTest, fn) \
1012 (void)(fn)((hwnd), WM_NCMBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
1014 /* int Cls_OnMouseActivate(HWND hwnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg) */
1015 #define HANDLE_WM_MOUSEACTIVATE(hwnd, wParam, lParam, fn) \
1016 (LRESULT)(DWORD)(int)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
1017 #define FORWARD_WM_MOUSEACTIVATE(hwnd, hwndTopLevel, codeHitTest, msg, fn) \
1018 (int)(DWORD)(fn)((hwnd), WM_MOUSEACTIVATE, (WPARAM)(HWND)(hwndTopLevel), MAKELPARAM((codeHitTest), (msg)))
1020 /* void Cls_OnCancelMode(HWND hwnd) */
1021 #define HANDLE_WM_CANCELMODE(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1022 #define FORWARD_WM_CANCELMODE(hwnd, fn) (void)(fn)((hwnd), WM_CANCELMODE, 0L, 0L)
1024 /* void Cls_OnInitMenu(HWND hwnd, HMENU hMenu) */
1025 #define HANDLE_WM_INITMENU(hwnd, wParam, lParam, fn) \
1026 ((fn)((hwnd), (HMENU)(wParam)), 0L)
1027 #define FORWARD_WM_INITMENU(hwnd, hMenu, fn) \
1028 (void)(fn)((hwnd), WM_INITMENU, (WPARAM)(HMENU)(hMenu), 0L)
1030 /* void Cls_OnMenuSelect(HWND hwnd, HMENU hmenu, int item, HMENU hmenuPopup, UINT flags) */
1031 #define HANDLE_WM_MENUSELECT(hwnd, wParam, lParam, fn) \
1032 ((fn)((hwnd), (HMENU)(lParam), \
1033 (HIWORD(wParam) & MF_POPUP) ? 0L : (int)(LOWORD(wParam)), \
1034 (HIWORD(wParam) & MF_POPUP) ? GetSubMenu((HMENU)lParam, LOWORD(wParam)) : 0L, \
1035 (UINT)(((short)HIWORD(wParam) == -1) ? 0xFFFFFFFF : HIWORD(wParam))), 0L)
1036 #define FORWARD_WM_MENUSELECT(hwnd, hmenu, item, hmenuPopup, flags, fn) \
1037 (void)(fn)((hwnd), WM_MENUSELECT, MAKEWPARAM((item), (flags)), (LPARAM)(HMENU)((hmenu) ? (hmenu) : (hmenuPopup)))
1039 /* DWORD Cls_OnMenuChar(HWND hwnd, UINT ch, UINT flags, HMENU hmenu) */
1040 #define HANDLE_WM_MENUCHAR(hwnd, wParam, lParam, fn) \
1041 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(LOWORD(wParam)), (UINT)HIWORD(wParam), (HMENU)(lParam))
1042 #define FORWARD_WM_MENUCHAR(hwnd, ch, flags, hmenu, fn) \
1043 (DWORD)(fn)((hwnd), WM_MENUCHAR, MAKEWPARAM(flags, (WORD)(ch)), (LPARAM)(HMENU)(hmenu))
1045 /* void Cls_OnHScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) */
1046 #define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \
1047 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
1048 #define FORWARD_WM_HSCROLL(hwnd, hwndCtl, code, pos, fn) \
1049 (void)(fn)((hwnd), WM_HSCROLL, MAKEWPARAM((UINT)(int)(code),(UINT)(int)(pos)), (LPARAM)(UINT)(hwndCtl))
1051 /* void Cls_OnVScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) */
1052 #define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \
1053 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
1054 #define FORWARD_WM_VSCROLL(hwnd, hwndCtl, code, pos, fn) \
1055 (void)(fn)((hwnd), WM_VSCROLL, MAKEWPARAM((UINT)(int)(code), (UINT)(int)(pos)), (LPARAM)(HWND)(hwndCtl))
1057 /* void Cls_OnCut(HWND hwnd) */
1058 #define HANDLE_WM_CUT(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1059 #define FORWARD_WM_CUT(hwnd, fn) (void)(fn)((hwnd), WM_CUT, 0L, 0L)
1061 /* void Cls_OnCopy(HWND hwnd) */
1062 #define HANDLE_WM_COPY(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1063 #define FORWARD_WM_COPY(hwnd, fn) (void)(fn)((hwnd), WM_COPY, 0L, 0L)
1065 /* void Cls_OnPaste(HWND hwnd) */
1066 #define HANDLE_WM_PASTE(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1067 #define FORWARD_WM_PASTE(hwnd, fn) (void)(fn)((hwnd), WM_PASTE, 0L, 0L)
1069 /* void Cls_OnClear(HWND hwnd) */
1070 #define HANDLE_WM_CLEAR(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1071 #define FORWARD_WM_CLEAR(hwnd, fn) (void)(fn)((hwnd), WM_CLEAR, 0L, 0L)
1073 /* void Cls_OnUndo(HWND hwnd) */
1074 #define HANDLE_WM_UNDO(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1075 #define FORWARD_WM_UNDO(hwnd, fn) (void)(fn)((hwnd), WM_UNDO, 0L, 0L)
1077 /* HANDLE Cls_OnRenderFormat(HWND hwnd, UINT fmt) */
1078 #define HANDLE_WM_RENDERFORMAT(hwnd, wParam, lParam, fn) \
1079 (LRESULT)(DWORD)(UINT)(HANDLE)(fn)((hwnd), (UINT)(wParam))
1080 #define FORWARD_WM_RENDERFORMAT(hwnd, fmt, fn) \
1081 (HANDLE)(UINT)(DWORD)(fn)((hwnd), WM_RENDERFORMAT, (WPARAM)(UINT)(fmt), 0L)
1083 /* void Cls_OnRenderAllFormats(HWND hwnd) */
1084 #define HANDLE_WM_RENDERALLFORMATS(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1085 #define FORWARD_WM_RENDERALLFORMATS(hwnd, fn) (void)(fn)((hwnd), WM_RENDERALLFORMATS, 0L, 0L)
1087 /* void Cls_OnDestroyClipboard(HWND hwnd) */
1088 #define HANDLE_WM_DESTROYCLIPBOARD(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1089 #define FORWARD_WM_DESTROYCLIPBOARD(hwnd, fn) (void)(fn)((hwnd), WM_DESTROYCLIPBOARD, 0L, 0L)
1091 /* void Cls_OnDrawClipboard(HWND hwnd) */
1092 #define HANDLE_WM_DRAWCLIPBOARD(hwnd, wParam, lParam, fn) ((fn)(hwnd), 0L)
1093 #define FORWARD_WM_DRAWCLIPBOARD(hwnd, fn) (void)(fn)((hwnd), WM_DRAWCLIPBOARD, 0L, 0L)
1095 /* void Cls_OnPaintClipboard(HWND hwnd, HWND hwndCBViewer, const LPPAINTSTRUCT lpPaintStruct) */
1096 #define HANDLE_WM_PAINTCLIPBOARD(hwnd, wParam, lParam, fn) \
1097 ((fn)((hwnd), (HWND)(wParam), (const LPPAINTSTRUCT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
1098 #define FORWARD_WM_PAINTCLIPBOARD(hwnd, hwndCBViewer, lpPaintStruct, fn) \
1099 (void)(fn)((hwnd), WM_PAINTCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPPAINTSTRUCT)(lpPaintStruct))
1101 /* void Cls_OnSizeClipboard(HWND hwnd, HWND hwndCBViewer, const LPRECT lprc) */
1102 #define HANDLE_WM_SIZECLIPBOARD(hwnd, wParam, lParam, fn) \
1103 ((fn)((hwnd), (HWND)(wParam), (const LPRECT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
1104 #define FORWARD_WM_SIZECLIPBOARD(hwnd, hwndCBViewer, lprc, fn) \
1105 (void)(fn)((hwnd), WM_SIZECLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPRECT)(lprc))
1107 /* void Cls_OnVScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos) */
1108 #define HANDLE_WM_VSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
1109 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1110 #define FORWARD_WM_VSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
1111 (void)(fn)((hwnd), WM_VSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
1113 /* void Cls_OnHScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos) */
1114 #define HANDLE_WM_HSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
1115 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1116 #define FORWARD_WM_HSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
1117 (void)(fn)((hwnd), WM_HSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
1119 /* void Cls_OnAskCBFormatName(HWND hwnd, int cchMax, LPTSTR rgchName) */
1120 #define HANDLE_WM_ASKCBFORMATNAME(hwnd, wParam, lParam, fn) \
1121 ((fn)((hwnd), (int)(wParam), (LPTSTR)(lParam)), 0L)
1122 #define FORWARD_WM_ASKCBFORMATNAME(hwnd, cchMax, rgchName, fn) \
1123 (void)(fn)((hwnd), WM_ASKCBFORMATNAME, (WPARAM)(int)(cchMax), (LPARAM)(rgchName))
1125 /* void Cls_OnChangeCBChain(HWND hwnd, HWND hwndRemove, HWND hwndNext) */
1126 #define HANDLE_WM_CHANGECBCHAIN(hwnd, wParam, lParam, fn) \
1127 ((fn)((hwnd), (HWND)(wParam), (HWND)(lParam)), 0L)
1128 #define FORWARD_WM_CHANGECBCHAIN(hwnd, hwndRemove, hwndNext, fn) \
1129 (void)(fn)((hwnd), WM_CHANGECBCHAIN, (WPARAM)(HWND)(hwndRemove), (LPARAM)(HWND)(hwndNext))
1131 /* BOOL Cls_OnSetCursor(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg) */
1132 #define HANDLE_WM_SETCURSOR(hwnd, wParam, lParam, fn) \
1133 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
1134 #define FORWARD_WM_SETCURSOR(hwnd, hwndCursor, codeHitTest, msg, fn) \
1135 (BOOL)(DWORD)(fn)((hwnd), WM_SETCURSOR, (WPARAM)(HWND)(hwndCursor), MAKELPARAM((codeHitTest), (msg)))
1137 /* void Cls_OnSysCommand(HWND hwnd, UINT cmd, int x, int y) */
1138 #define HANDLE_WM_SYSCOMMAND(hwnd, wParam, lParam, fn) \
1139 ((fn)((hwnd), (UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
1140 #define FORWARD_WM_SYSCOMMAND(hwnd, cmd, x, y, fn) \
1141 (void)(fn)((hwnd), WM_SYSCOMMAND, (WPARAM)(UINT)(cmd), MAKELPARAM((x), (y)))
1143 /* HWND Cls_MDICreate(HWND hwnd, const LPMDICREATESTRUCT lpmcs) */
1144 #define HANDLE_WM_MDICREATE(hwnd, wParam, lParam, fn) \
1145 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (LPMDICREATESTRUCT)(lParam))
1146 #define FORWARD_WM_MDICREATE(hwnd, lpmcs, fn) \
1147 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDICREATE, 0L, (LPARAM)(LPMDICREATESTRUCT)(lpmcs))
1149 /* void Cls_MDIDestroy(HWND hwnd, HWND hwndDestroy) */
1150 #define HANDLE_WM_MDIDESTROY(hwnd, wParam, lParam, fn) \
1151 ((fn)((hwnd), (HWND)(wParam)), 0L)
1152 #define FORWARD_WM_MDIDESTROY(hwnd, hwndDestroy, fn) \
1153 (void)(fn)((hwnd), WM_MDIDESTROY, (WPARAM)(hwndDestroy), 0L)
1155 /* NOTE: Usable only by MDI client windows */
1156 /* void Cls_MDIActivate(HWND hwnd, BOOL fActive, HWND hwndActivate, HWND hwndDeactivate) */
1157 #define HANDLE_WM_MDIACTIVATE(hwnd, wParam, lParam, fn) \
1158 ((fn)((hwnd), (BOOL)(lParam == (LPARAM)hwnd), (HWND)(lParam), (HWND)(wParam)), 0L)
1159 #define FORWARD_WM_MDIACTIVATE(hwnd, fActive, hwndActivate, hwndDeactivate, fn) \
1160 (void)(fn)(hwnd, WM_MDIACTIVATE, (WPARAM)(hwndDeactivate), (LPARAM)(hwndActivate))
1162 /* void Cls_MDIRestore(HWND hwnd, HWND hwndRestore) */
1163 #define HANDLE_WM_MDIRESTORE(hwnd, wParam, lParam, fn) \
1164 ((fn)((hwnd), (HWND)(wParam)), 0L)
1165 #define FORWARD_WM_MDIRESTORE(hwnd, hwndRestore, fn) \
1166 (void)(fn)((hwnd), WM_MDIRESTORE, (WPARAM)(hwndRestore), 0L)
1168 /* HWND Cls_MDINext(HWND hwnd, HWND hwndCur, BOOL fPrev) */
1169 #define HANDLE_WM_MDINEXT(hwnd, wParam, lParam, fn) \
1170 (LRESULT)(HWND)(fn)((hwnd), (HWND)(wParam), (BOOL)lParam)
1171 #define FORWARD_WM_MDINEXT(hwnd, hwndCur, fPrev, fn) \
1172 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDINEXT, (WPARAM)(hwndCur), (LPARAM)(fPrev))
1174 /* void Cls_MDIMaximize(HWND hwnd, HWND hwndMaximize) */
1175 #define HANDLE_WM_MDIMAXIMIZE(hwnd, wParam, lParam, fn) \
1176 ((fn)((hwnd), (HWND)(wParam)), 0L)
1177 #define FORWARD_WM_MDIMAXIMIZE(hwnd, hwndMaximize, fn) \
1178 (void)(fn)((hwnd), WM_MDIMAXIMIZE, (WPARAM)(hwndMaximize), 0L)
1180 /* BOOL Cls_MDITile(HWND hwnd, UINT cmd) */
1181 #define HANDLE_WM_MDITILE(hwnd, wParam, lParam, fn) \
1182 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
1183 #define FORWARD_WM_MDITILE(hwnd, cmd, fn) \
1184 (BOOL)(DWORD)(fn)((hwnd), WM_MDITILE, (WPARAM)(cmd), 0L)
1186 /* BOOL Cls_MDICascade(HWND hwnd, UINT cmd) */
1187 #define HANDLE_WM_MDICASCADE(hwnd, wParam, lParam, fn) \
1188 (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
1189 #define FORWARD_WM_MDICASCADE(hwnd, cmd, fn) \
1190 (BOOL)(DWORD)(fn)((hwnd), WM_MDICASCADE, (WPARAM)(cmd), 0L)
1192 /* void Cls_MDIIconArrange(HWND hwnd) */
1193 #define HANDLE_WM_MDIICONARRANGE(hwnd, wParam, lParam, fn) \
1194 ((fn)(hwnd), 0L)
1195 #define FORWARD_WM_MDIICONARRANGE(hwnd, fn) \
1196 (void)(fn)((hwnd), WM_MDIICONARRANGE, 0L, 0L)
1198 /* HWND Cls_MDIGetActive(HWND hwnd) */
1199 #define HANDLE_WM_MDIGETACTIVE(hwnd, wParam, lParam, fn) \
1200 (LRESULT)(DWORD)(UINT)(fn)(hwnd)
1201 #define FORWARD_WM_MDIGETACTIVE(hwnd, fn) \
1202 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDIGETACTIVE, 0L, 0L)
1204 /* HMENU Cls_MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) */
1205 #define HANDLE_WM_MDISETMENU(hwnd, wParam, lParam, fn) \
1206 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(wParam), (HMENU)(wParam), (HMENU)(lParam))
1207 #define FORWARD_WM_MDISETMENU(hwnd, fRefresh, hmenuFrame, hmenuWindow, fn) \
1208 (HMENU)(UINT)(DWORD)(fn)((hwnd), WM_MDISETMENU, (WPARAM)((fRefresh) ? (hmenuFrame) : 0), (LPARAM)(hmenuWindow))
1210 /* void Cls_OnChildActivate(HWND hwnd) */
1211 #define HANDLE_WM_CHILDACTIVATE(hwnd, wParam, lParam, fn) \
1212 ((fn)(hwnd), 0L)
1213 #define FORWARD_WM_CHILDACTIVATE(hwnd, fn) \
1214 (void)(fn)((hwnd), WM_CHILDACTIVATE, 0L, 0L)
1216 /* BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) */
1217 #define HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, fn) \
1218 (LRESULT)(DWORD)(UINT)(BOOL)(fn)((hwnd), (HWND)(wParam), lParam)
1219 #define FORWARD_WM_INITDIALOG(hwnd, hwndFocus, lParam, fn) \
1220 (BOOL)(DWORD)(fn)((hwnd), WM_INITDIALOG, (WPARAM)(HWND)(hwndFocus), (lParam))
1222 /* HWND Cls_OnNextDlgCtl(HWND hwnd, HWND hwndSetFocus, BOOL fNext) */
1223 #define HANDLE_WM_NEXTDLGCTL(hwnd, wParam, lParam, fn) \
1224 (LRESULT)(DWORD)(UINT)(HWND)(fn)((hwnd), (HWND)(wParam), (BOOL)(lParam))
1225 #define FORWARD_WM_NEXTDLGCTL(hwnd, hwndSetFocus, fNext, fn) \
1226 (HWND)(UINT)(DWORD)(fn)((hwnd), WM_NEXTDLGCTL, (WPARAM)(HWND)(hwndSetFocus), (LPARAM)(fNext))
1228 /* void Cls_OnParentNotify(HWND hwnd, UINT msg, HWND hwndChild, int idChild) */
1229 #define HANDLE_WM_PARENTNOTIFY(hwnd, wParam, lParam, fn) \
1230 ((fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
1231 #define FORWARD_WM_PARENTNOTIFY(hwnd, msg, hwndChild, idChild, fn) \
1232 (void)(fn)((hwnd), WM_PARENTNOTIFY, MAKEWPARAM(msg, idChild), (LPARAM)(hwndChild))
1234 /* void Cls_OnEnterIdle(HWND hwnd, UINT source, HWND hwndSource) */
1235 #define HANDLE_WM_ENTERIDLE(hwnd, wParam, lParam, fn) \
1236 ((fn)((hwnd), (UINT)(wParam), (HWND)(lParam)), 0L)
1237 #define FORWARD_WM_ENTERIDLE(hwnd, source, hwndSource, fn) \
1238 (void)(fn)((hwnd), WM_ENTERIDLE, (WPARAM)(UINT)(source), (LPARAM)(HWND)(hwndSource))
1240 /* UINT Cls_OnGetDlgCode(HWND hwnd, LPMSG lpmsg) */
1241 #define HANDLE_WM_GETDLGCODE(hwnd, wParam, lParam, fn) \
1242 (LRESULT)(DWORD)(UINT)(fn)(hwnd, (LPMSG)(lParam))
1243 #define FORWARD_WM_GETDLGCODE(hwnd, lpmsg, fn) \
1244 (UINT)(DWORD)(fn)((hwnd), WM_GETDLGCODE, (lpmsg ? lpmsg->wParam : 0), (LPARAM)(LPMSG)(lpmsg))
1246 /* HBRUSH Cls_OnCtlColor(HWND hwnd, HDC hdc, HWND hwndChild, int type) */
1247 #define HANDLE_WM_CTLCOLORMSGBOX(hwnd, wParam, lParam, fn) \
1248 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_MSGBOX)
1249 #define FORWARD_WM_CTLCOLORMSGBOX(hwnd, hdc, hwndChild, fn) \
1250 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORMSGBOX, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1252 #define HANDLE_WM_CTLCOLOREDIT(hwnd, wParam, lParam, fn) \
1253 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_EDIT)
1254 #define FORWARD_WM_CTLCOLOREDIT(hwnd, hdc, hwndChild, fn) \
1255 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLOREDIT, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1257 #define HANDLE_WM_CTLCOLORLISTBOX(hwnd, wParam, lParam, fn) \
1258 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_LISTBOX)
1259 #define FORWARD_WM_CTLCOLORLISTBOX(hwnd, hdc, hwndChild, fn) \
1260 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORLISTBOX, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1262 #define HANDLE_WM_CTLCOLORBTN(hwnd, wParam, lParam, fn) \
1263 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_BTN)
1264 #define FORWARD_WM_CTLCOLORBTN(hwnd, hdc, hwndChild, fn) \
1265 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORBTN, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1267 #define HANDLE_WM_CTLCOLORDLG(hwnd, wParam, lParam, fn) \
1268 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_DLG)
1269 #define FORWARD_WM_CTLCOLORDLG(hwnd, hdc, hwndChild, fn) \
1270 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORDLG, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1272 #define HANDLE_WM_CTLCOLORSCROLLBAR(hwnd, wParam, lParam, fn) \
1273 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_SCROLLBAR)
1274 #define FORWARD_WM_CTLCOLORSCROLLBAR(hwnd, hdc, hwndChild, fn) \
1275 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORSCROLLBAR, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1277 #define HANDLE_WM_CTLCOLORSTATIC(hwnd, wParam, lParam, fn) \
1278 (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)(lParam), CTLCOLOR_STATIC)
1279 #define FORWARD_WM_CTLCOLORSTATIC(hwnd, hdc, hwndChild, fn) \
1280 (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLORSTATIC, (WPARAM)(HDC)(hdc), (LPARAM)(HWND)(hwndChild))
1282 /* void Cls_OnDeleteItem(HWND hwnd, const DELETEITEMSTRUCT * lpDeleteItem) */
1283 #define HANDLE_WM_DELETEITEM(hwnd, wParam, lParam, fn) \
1284 ((fn)((hwnd), (const DELETEITEMSTRUCT *)(lParam)), 0L)
1285 #define FORWARD_WM_DELETEITEM(hwnd, lpDeleteItem, fn) \
1286 (void)(fn)((hwnd), WM_DELETEITEM, (WPARAM)(((const DELETEITEMSTRUCT *)(lpDeleteItem))->CtlID), (LPARAM)(const DELETEITEMSTRUCT *)(lpDeleteItem))
1288 /* int Cls_OnCompareItem(HWND hwnd, const COMPAREITEMSTRUCT * lpCompareItem) */
1289 #define HANDLE_WM_COMPAREITEM(hwnd, wParam, lParam, fn) \
1290 (LRESULT)(DWORD)(int)(fn)((hwnd), (const COMPAREITEMSTRUCT *)(lParam))
1291 #define FORWARD_WM_COMPAREITEM(hwnd, lpCompareItem, fn) \
1292 (int)(DWORD)(fn)((hwnd), WM_COMPAREITEM, (WPARAM)(((const COMPAREITEMSTRUCT *)(lpCompareItem))->CtlID), (LPARAM)(const COMPAREITEMSTRUCT *)(lpCompareItem))
1294 /* int Cls_OnVkeyToItem(HWND hwnd, UINT vk, HWND hwndListbox, int iCaret) */
1295 #define HANDLE_WM_VKEYTOITEM(hwnd, wParam, lParam, fn) \
1296 (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
1297 #define FORWARD_WM_VKEYTOITEM(hwnd, vk, hwndListBox, iCaret, fn) \
1298 (int)(DWORD)(fn)((hwnd), WM_VKEYTOITEM, MAKEWPARAM((vk), (iCaret)), (LPARAM)(hwndListBox))
1300 /* int Cls_OnCharToItem(HWND hwnd, UINT ch, HWND hwndListbox, int iCaret) */
1301 #define HANDLE_WM_CHARTOITEM(hwnd, wParam, lParam, fn) \
1302 (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
1303 #define FORWARD_WM_CHARTOITEM(hwnd, ch, hwndListBox, iCaret, fn) \
1304 (int)(DWORD)(fn)((hwnd), WM_CHARTOITEM, MAKEWPARAM((UINT)(ch), (UINT)(iCaret)), (LPARAM)(hwndListBox))
1306 /* void Cls_OnQueueSync(HWND hwnd) */
1307 #define HANDLE_WM_QUEUESYNC(hwnd, wParam, lParam, fn) \
1308 ((fn)(hwnd), 0L)
1309 #define FORWARD_WM_QUEUESYNC(hwnd, fn) \
1310 (void)(fn)((hwnd), WM_QUEUESYNC, 0L, 0L)
1311 /* void Cls_OnCommNotify(HWND hwnd, int cid, UINT flags) */
1312 #define HANDLE_WM_COMMNOTIFY(hwnd, wParam, lParam, fn) \
1313 ((fn)((hwnd), (int)(wParam), (UINT)LOWORD(lParam)), 0L)
1314 #define FORWARD_WM_COMMNOTIFY(hwnd, cid, flags, fn) \
1315 (void)(fn)((hwnd), WM_COMMNOTIFY, (WPARAM)(cid), MAKELPARAM((flags), 0))
1317 /* void Cls_OnDisplayChange(HWND hwnd, UINT bitsPerPixel, UINT cxScreen, UINT cyScreen) */
1318 #define HANDLE_WM_DISPLAYCHANGE(hwnd, wParam, lParam, fn) \
1319 ((fn)((hwnd), (UINT)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(wParam)), 0L)
1320 #define FORWARD_WM_DISPLAYCHANGE(hwnd, bitsPerPixel, cxScreen, cyScreen, fn) \
1321 (void)(fn)((hwnd), WM_DISPLAYCHANGE, (WPARAM)(UINT)(bitsPerPixel), (LPARAM)MAKELPARAM((UINT)(cxScreen), (UINT)(cyScreen)))
1323 /* BOOL Cls_OnDeviceChange(HWND hwnd, UINT uEvent, DWORD dwEventData) */
1324 #define HANDLE_WM_DEVICECHANGE(hwnd, wParam, lParam, fn) \
1325 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (UINT)(wParam), (DWORD)(wParam))
1326 #define FORWARD_WM_DEVICECHANGE(hwnd, uEvent, dwEventData, fn) \
1327 (BOOL)(DWORD)(fn)((hwnd), WM_DEVICECHANGE, (WPARAM)(UINT)(uEvent), (LPARAM)(DWORD)(dwEventData))
1329 /* void Cls_OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos) */
1330 #define HANDLE_WM_CONTEXTMENU(hwnd, wParam, lParam, fn) \
1331 ((fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
1332 #define FORWARD_WM_CONTEXTMENU(hwnd, hwndContext, xPos, yPos, fn) \
1333 (void)(fn)((hwnd), WM_CONTEXTMENU, (WPARAM)(HWND)(hwndContext), MAKELPARAM((UINT)(xPos), (UINT)(yPos)))
1335 /* void Cls_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT * lpMeasureItem) */
1336 #define HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, fn) \
1337 ((fn)((hwnd), (MEASUREITEMSTRUCT *)(lParam)), 0L)
1338 #define FORWARD_WM_MEASUREITEM(hwnd, lpMeasureItem, fn) \
1339 (void)(fn)((hwnd), WM_MEASUREITEM, (WPARAM)(((MEASUREITEMSTRUCT *)lpMeasureItem)->CtlID), (LPARAM)(MEASUREITEMSTRUCT *)(lpMeasureItem))
1341 /* void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) */
1342 #define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \
1343 ((fn)((hwnd), (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
1344 #define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \
1345 (void)(fn)((hwnd), WM_COMMAND, MAKEWPARAM((UINT)(id),(UINT)(codeNotify)), (LPARAM)(HWND)(hwndCtl))
1347 /* void Cls_OnTimer(HWND hwnd, UINT id) */
1348 #define HANDLE_WM_TIMER(hwnd, wParam, lParam, fn) ((fn)((hwnd), (UINT)(wParam)), 0L)
1349 #define FORWARD_WM_TIMER(hwnd, id, fn) (void)(fn)((hwnd), WM_TIMER, (WPARAM)(UINT)(id), 0L)
1351 /* void Cls_OnInitMenuPopup(HWND hwnd, HMENU hMenu, UINT item, BOOL fSystemMenu) */
1352 #define HANDLE_WM_INITMENUPOPUP(hwnd, wParam, lParam, fn) \
1353 ((fn)((hwnd), (HMENU)(wParam), (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
1354 #define FORWARD_WM_INITMENUPOPUP(hwnd, hMenu, item, fSystemMenu, fn) \
1355 (void)(fn)((hwnd), WM_INITMENUPOPUP, (WPARAM)(HMENU)(hMenu), MAKELPARAM((item),(fSystemMenu)))
1357 /* UINT Cls_OnNCHitTest(HWND hwnd, int x, int y) */
1358 #define HANDLE_WM_NCHITTEST(hwnd, wParam, lParam, fn) \
1359 (LRESULT)(DWORD)(UINT)(fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam))
1360 #define FORWARD_WM_NCHITTEST(hwnd, x, y, fn) \
1361 (UINT)(DWORD)(fn)((hwnd), WM_NCHITTEST, 0L, MAKELPARAM((x), (y)))
1363 /* HFONT Cls_OnGetFont(HWND hwnd) */
1364 #define HANDLE_WM_GETFONT(hwnd, wParam, lParam, fn) (LRESULT)(DWORD)(UINT)(HFONT)(fn)(hwnd)
1365 #define FORWARD_WM_GETFONT(hwnd, fn) (HFONT)(UINT)(DWORD)(fn)((hwnd), WM_GETFONT, 0L, 0L)
1367 /* void Cls_OnSetFont(HWND hwndCtl, HFONT hfont, BOOL fRedraw) */
1368 #define HANDLE_WM_SETFONT(hwnd, wParam, lParam, fn) \
1369 ((fn)((hwnd), (HFONT)(wParam), (BOOL)(lParam)), 0L)
1370 #define FORWARD_WM_SETFONT(hwnd, hfont, fRedraw, fn) \
1371 (void)(fn)((hwnd), WM_SETFONT, (WPARAM)(HFONT)(hfont), (LPARAM)(BOOL)(fRedraw))
1373 /* void Cls_OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO lpMinMaxInfo) */
1374 #define HANDLE_WM_GETMINMAXINFO(hwnd, wParam, lParam, fn) \
1375 ((fn)((hwnd), (LPMINMAXINFO)(lParam)), 0L)
1376 #define FORWARD_WM_GETMINMAXINFO(hwnd, lpMinMaxInfo, fn) \
1377 (void)(fn)((hwnd), WM_GETMINMAXINFO, 0L, (LPARAM)(LPMINMAXINFO)(lpMinMaxInfo))
1379 /* void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT lpDrawItem) */
1380 #define HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, fn) \
1381 ((fn)((hwnd), (const DRAWITEMSTRUCT *)(lParam)), 0L)
1382 #define FORWARD_WM_DRAWITEM(hwnd, lpDrawItem, fn) \
1383 (void)(fn)((hwnd), WM_DRAWITEM, (WPARAM)(((const DRAWITEMSTRUCT *)lpDrawItem)->CtlID), (LPARAM)(const DRAWITEMSTRUCT *)(lpDrawItem))
1386 /****** C runtime porting macros ****************************************/
1388 #define _ncalloc calloc
1389 #define _nexpand _expand
1390 #define _ffree free
1391 #define _fmalloc malloc
1392 #define _fmemccpy _memccpy
1393 #define _fmemchr memchr
1394 #define _fmemcmp memcmp
1395 #define _fmemcpy memcpy
1396 #define _fmemicmp _memicmp
1397 #define _fmemmove memmove
1398 #define _fmemset memset
1399 #define _fmsize _msize
1400 #define _frealloc realloc
1401 #define _fstrcat strcat
1402 #define _fstrchr strchr
1403 #define _fstrcmp strcmp
1404 #define _fstrcpy strcpy
1405 #define _fstrcspn strcspn
1406 #define _fstrdup _strdup
1407 #define _fstricmp _stricmp
1408 #define _fstrlen strlen
1409 #define _fstrlwr _strlwr
1410 #define _fstrncat strncat
1411 #define _fstrncmp strncmp
1412 #define _fstrncpy strncpy
1413 #define _fstrnicmp _strnicmp
1414 #define _fstrnset _strnset
1415 #define _fstrpbrk strpbrk
1416 #define _fstrrchr strrchr
1417 #define _fstrrev _strrev
1418 #define _fstrset _strset
1419 #define _fstrspn strspn
1420 #define _fstrstr strstr
1421 #define _fstrtok strtok
1422 #define _fstrupr _strupr
1423 #define _nfree free
1424 #define _nmalloc malloc
1425 #define _nmsize _msize
1426 #define _nrealloc realloc
1427 #define _nstrdup _strdup
1428 #define hmemcpy MoveMemory
1430 #ifdef __cplusplus
1432 #endif
1434 #endif