Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1213 lines
67 KiB

  1. /****************************************************************************
  2. * *
  3. * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
  4. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
  5. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
  6. * PURPOSE. *
  7. * *
  8. * Copyright (C) 1993-95 Microsoft Corporation. All Rights Reserved. *
  9. * *
  10. ****************************************************************************/
  11. /*****************************************************************************\
  12. * *
  13. * windowsx.h - Macro APIs, window message crackers, and control APIs *
  14. * *
  15. * Version 3.10 *
  16. * *
  17. \*****************************************************************************/
  18. #ifndef _INC_WINDOWSX
  19. #define _INC_WINDOWSX
  20. #ifndef RC_INVOKED
  21. #pragma pack(1) /* Assume byte packing throughout */
  22. #endif /* RC_INVOKED */
  23. #ifdef __cplusplus
  24. extern "C" { /* Assume C declarations for C++ */
  25. #endif /* __cplusplus */
  26. /****** KERNEL Macro APIs ****************************************************/
  27. #define GetInstanceModule(hInstance) \
  28. GetModuleHandle((LPCSTR)MAKELP(0, hInstance))
  29. #define GlobalPtrHandle(lp) \
  30. ((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp))))
  31. #define GlobalLockPtr(lp) \
  32. ((BOOL)SELECTOROF(GlobalLock(GlobalPtrHandle(lp))))
  33. #define GlobalUnlockPtr(lp) \
  34. GlobalUnlock(GlobalPtrHandle(lp))
  35. #define GlobalAllocPtr(flags, cb) \
  36. (GlobalLock(GlobalAlloc((flags), (cb))))
  37. #define GlobalReAllocPtr(lp, cbNew, flags) \
  38. (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
  39. #define GlobalFreePtr(lp) \
  40. (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
  41. /****** GDI Macro APIs *******************************************************/
  42. #define DeletePen(hpen) DeleteObject((HGDIOBJ)(HPEN)(hpen))
  43. #define SelectPen(hdc, hpen) ((HPEN)SelectObject((hdc), (HGDIOBJ)(HPEN)(hpen)))
  44. #define GetStockPen(i) ((HPEN)GetStockObject(i))
  45. #define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr))
  46. #define SelectBrush(hdc, hbr) ((HBRUSH)SelectObject((hdc), (HGDIOBJ)(HBRUSH)(hbr)))
  47. #define GetStockBrush(i) ((HBRUSH)GetStockObject(i))
  48. #define DeleteRgn(hrgn) DeleteObject((HGDIOBJ)(HRGN)(hrgn))
  49. #define CopyRgn(hrgnDst, hrgnSrc) CombineRgn(hrgnDst, hrgnSrc, 0, RGN_COPY)
  50. #define IntersectRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND)
  51. #define SubtractRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF)
  52. #define UnionRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR)
  53. #define XorRgn(hrgnResult, hrgnA, hrgnB) CombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR)
  54. #define DeletePalette(hpal) DeleteObject((HGDIOBJ)(HPALETTE)(hpal))
  55. #define DeleteFont(hfont) DeleteObject((HGDIOBJ)(HFONT)(hfont))
  56. #define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT)(hfont)))
  57. #define GetStockFont(i) ((HFONT)GetStockObject(i))
  58. #define DeleteBitmap(hbm) DeleteObject((HGDIOBJ)(HBITMAP)(hbm))
  59. #define SelectBitmap(hdc, hbm) ((HBITMAP)SelectObject((hdc), (HGDIOBJ)(HBITMAP)(hbm)))
  60. #define InsetRect(lprc, dx, dy) InflateRect((lprc), -(dx), -(dy))
  61. /****** USER Macro APIs ******************************************************/
  62. #define GetWindowInstance(hwnd) ((HINSTANCE)GetWindowWord(hwnd, GWW_HINSTANCE))
  63. #define GetWindowStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_STYLE))
  64. #define GetWindowExStyle(hwnd) ((DWORD)GetWindowLong(hwnd, GWL_EXSTYLE))
  65. #define GetWindowOwner(hwnd) GetWindow(hwnd, GW_OWNER)
  66. #define GetFirstChild(hwnd) GetTopWindow(hwnd)
  67. #define GetFirstSibling(hwnd) GetWindow(hwnd, GW_HWNDFIRST)
  68. #define GetLastSibling(hwnd) GetWindow(hwnd, GW_HWNDLAST)
  69. #define GetNextSibling(hwnd) GetWindow(hwnd, GW_HWNDNEXT)
  70. #define GetPrevSibling(hwnd) GetWindow(hwnd, GW_HWNDPREV)
  71. #define GetWindowID(hwnd) GetDlgCtrlID(hwnd)
  72. #define SetWindowRedraw(hwnd, fRedraw) \
  73. ((void)SendMessage(hwnd, WM_SETREDRAW, (WPARAM)(BOOL)(fRedraw), 0L))
  74. #define SubclassWindow(hwnd, lpfn) \
  75. ((WNDPROC)SetWindowLong((hwnd), GWL_WNDPROC, (LPARAM)(WNDPROC)(lpfn)))
  76. #define IsMinimized(hwnd) IsIconic(hwnd)
  77. #define IsMaximized(hwnd) IsZoomed(hwnd)
  78. #define IsRestored(hwnd) ((GetWindowStyle(hwnd) & (WS_MINIMIZE | WS_MAXIMIZE)) == 0L)
  79. #define SetWindowFont(hwnd, hfont, fRedraw) FORWARD_WM_SETFONT((hwnd), (hfont), (fRedraw), SendMessage)
  80. #define GetWindowFont(hwnd) FORWARD_WM_GETFONT((hwnd), SendMessage)
  81. #if (WINVER >= 0x030a)
  82. #define MapWindowRect(hwndFrom, hwndTo, lprc) \
  83. MapWindowPoints((hwndFrom), (hwndTo), (POINT FAR*)(lprc), 2)
  84. #endif /* WINVER >= 0x030a */
  85. #define IsLButtonDown() (GetKeyState(VK_LBUTTON) < 0)
  86. #define IsRButtonDown() (GetKeyState(VK_RBUTTON) < 0)
  87. #define IsMButtonDown() (GetKeyState(VK_MBUTTON) < 0)
  88. #define SubclassDialog(hwndDlg, lpfn) \
  89. ((DLGPROC)SetWindowLong(hwndDlg, DWL_DLGPROC, (LPARAM)(DLGPROC)(lpfn)))
  90. #define SetDlgMsgResult(hwnd, msg, result) \
  91. (((msg) == WM_CTLCOLOR || (msg) == WM_COMPAREITEM || (msg) == WM_VKEYTOITEM || \
  92. (msg) == WM_CHARTOITEM || (msg) == WM_QUERYDRAGICON || (msg) == WM_INITDIALOG) \
  93. ? (BOOL)LOWORD(result) : (SetWindowLong((hwnd), DWL_MSGRESULT, (LPARAM)(LRESULT)(result)), TRUE))
  94. #define DefDlgProcEx(hwnd, msg, wParam, lParam, pfRecursion) \
  95. (*(pfRecursion) = TRUE, DefDlgProc(hwnd, msg, wParam, lParam))
  96. #define CheckDefDlgRecursion(pfRecursion) \
  97. if (*(pfRecursion)) { *(pfRecursion) = FALSE; return FALSE; }
  98. /****** Message crackers ****************************************************/
  99. #define HANDLE_MSG(hwnd, message, fn) \
  100. case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
  101. /* void Cls_OnCompacting(HWND hwnd, UINT compactRatio); */
  102. #define HANDLE_WM_COMPACTING(hwnd, wParam, lParam, fn) \
  103. ((fn)((hwnd), (UINT)(wParam)), 0L)
  104. #define FORWARD_WM_COMPACTING(hwnd, compactRatio, fn) \
  105. (void)(fn)((hwnd), WM_COMPACTING, (WPARAM)(UINT)(compactRatio), 0L)
  106. /* void Cls_OnWinIniChange(HWND hwnd, LPCSTR lpszSectionName); */
  107. #define HANDLE_WM_WININICHANGE(hwnd, wParam, lParam, fn) \
  108. ((fn)((hwnd), (LPCSTR)(lParam)), 0L)
  109. #define FORWARD_WM_WININICHANGE(hwnd, lpszSectionName, fn) \
  110. (void)(fn)((hwnd), WM_WININICHANGE, 0, (LPARAM)(LPCSTR)(lpszSectionName))
  111. /* void Cls_OnSysColorChange(HWND hwnd); */
  112. #define HANDLE_WM_SYSCOLORCHANGE(hwnd, wParam, lParam, fn) \
  113. ((fn)(hwnd), 0L)
  114. #define FORWARD_WM_SYSCOLORCHANGE(hwnd, fn) \
  115. (void)(fn)((hwnd), WM_SYSCOLORCHANGE, 0, 0L)
  116. /* BOOL Cls_OnQueryNewPalette(HWND hwnd); */
  117. #define HANDLE_WM_QUERYNEWPALETTE(hwnd, wParam, lParam, fn) \
  118. MAKELRESULT((BOOL)(fn)(hwnd), 0)
  119. #define FORWARD_WM_QUERYNEWPALETTE(hwnd, fn) \
  120. (BOOL)(DWORD)(fn)((hwnd), WM_QUERYNEWPALETTE, 0, 0L)
  121. /* void Cls_OnPaletteIsChanging(HWND hwnd, HWND hwndPaletteChange); */
  122. #define HANDLE_WM_PALETTEISCHANGING(hwnd, wParam, lParam, fn) \
  123. ((fn)((hwnd), (HWND)(wParam)), 0L)
  124. #define FORWARD_WM_PALETTEISCHANGING(hwnd, hwndPaletteChange, fn) \
  125. (void)(fn)((hwnd), WM_PALETTEISCHANGING, (WPARAM)(HWND)(hwndPaletteChange), 0L)
  126. /* void Cls_OnPaletteChanged(HWND hwnd, HWND hwndPaletteChange); */
  127. #define HANDLE_WM_PALETTECHANGED(hwnd, wParam, lParam, fn) \
  128. ((fn)((hwnd), (HWND)(wParam)), 0L)
  129. #define FORWARD_WM_PALETTECHANGED(hwnd, hwndPaletteChange, fn) \
  130. (void)(fn)((hwnd), WM_PALETTECHANGED, (WPARAM)(HWND)(hwndPaletteChange), 0L)
  131. /* void Cls_OnFontChange(HWND hwnd); */
  132. #define HANDLE_WM_FONTCHANGE(hwnd, wParam, lParam, fn) \
  133. ((fn)(hwnd), 0L)
  134. #define FORWARD_WM_FONTCHANGE(hwnd, fn) \
  135. (void)(fn)((hwnd), WM_FONTCHANGE, 0, 0L)
  136. /* void Cls_OnSpoolerStatus(HWND hwnd, UINT status, int cJobInQueue); */
  137. #define HANDLE_WM_SPOOLERSTATUS(hwnd, wParam, lParam, fn) \
  138. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  139. #define FORWARD_WM_SPOOLERSTATUS(hwnd, status, cJobInQueue, fn) \
  140. (void)(fn)((hwnd), WM_SPOOLERSTATUS, (WPARAM)(status), MAKELPARAM((UINT)(cJobInQueue), 0))
  141. /* void Cls_OnDevModeChange(HWND hwnd, LPCSTR lpszDeviceName); */
  142. #define HANDLE_WM_DEVMODECHANGE(hwnd, wParam, lParam, fn) \
  143. ((fn)((hwnd), (LPCSTR)(lParam)), 0L)
  144. #define FORWARD_WM_DEVMODECHANGE(hwnd, lpszDeviceName, fn) \
  145. (void)(fn)((hwnd), WM_DEVMODECHANGE, 0,(LPARAM)(LPCSTR)(lpszDeviceName))
  146. /* void Cls_OnTimeChange(HWND hwnd); */
  147. #define HANDLE_WM_TIMECHANGE(hwnd, wParam, lParam, fn) \
  148. ((fn)(hwnd), 0L)
  149. #define FORWARD_WM_TIMECHANGE(hwnd, fn) \
  150. (void)(fn)((hwnd), WM_TIMECHANGE, 0, 0L)
  151. /* void Cls_OnPower(HWND hwnd, int code); */
  152. #define HANDLE_WM_POWER(hwnd, wParam, lParam, fn) \
  153. ((fn)((hwnd), (int)(wParam)), 0L)
  154. #define FORWARD_WM_POWER(hwnd, code, fn) \
  155. (void)(fn)((hwnd), WM_POWER, (WPARAM)(code), 0L)
  156. /* BOOL Cls_OnQueryEndSession(HWND hwnd); */
  157. #define HANDLE_WM_QUERYENDSESSION(hwnd, wParam, lParam, fn) \
  158. MAKELRESULT((BOOL)(fn)(hwnd), 0)
  159. #define FORWARD_WM_QUERYENDSESSION(hwnd, fn) \
  160. (BOOL)(DWORD)(fn)((hwnd), WM_QUERYENDSESSION, 0, 0L)
  161. /* void Cls_OnEndSession(HWND hwnd, BOOL fEnding); */
  162. #define HANDLE_WM_ENDSESSION(hwnd, wParam, lParam, fn) \
  163. ((fn)((hwnd), (BOOL)(wParam)), 0L)
  164. #define FORWARD_WM_ENDSESSION(hwnd, fEnding, fn) \
  165. (void)(fn)((hwnd), WM_ENDSESSION, (WPARAM)(BOOL)(fEnding), 0L)
  166. /* void Cls_OnQuit(HWND hwnd, int exitCode); */
  167. #define HANDLE_WM_QUIT(hwnd, wParam, lParam, fn) \
  168. ((fn)((hwnd), (int)(wParam)), 0L)
  169. #define FORWARD_WM_QUIT(hwnd, exitCode, fn) \
  170. (void)(fn)((hwnd), WM_QUIT, (WPARAM)(exitCode), 0L)
  171. /* void Cls_OnSystemError(HWND hwnd, int errCode); */
  172. #define HANDLE_WM_SYSTEMERROR(hwnd, wParam, lParam, fn) \
  173. ((fn)((hwnd), (int)(wParam)), 0L)
  174. #define FORWARD_WM_SYSTEMERROR(hwnd, errCode, fn) \
  175. (void)(fn)((hwnd), WM_SYSTEMERROR, (WPARAM)(errCode), 0L)
  176. /* BOOL Cls_OnCreate(HWND hwnd, CREATESTRUCT FAR* lpCreateStruct) */
  177. #define HANDLE_WM_CREATE(hwnd, wParam, lParam, fn) \
  178. ((fn)((hwnd), (CREATESTRUCT FAR*)(lParam)) ? 0L : (LRESULT)-1L)
  179. #define FORWARD_WM_CREATE(hwnd, lpCreateStruct, fn) \
  180. (BOOL)(DWORD)(fn)((hwnd), WM_CREATE, 0, (LPARAM)(CREATESTRUCT FAR*)(lpCreateStruct))
  181. /* BOOL Cls_OnNCCreate(HWND hwnd, CREATESTRUCT FAR* lpCreateStruct) */
  182. #define HANDLE_WM_NCCREATE(hwnd, wParam, lParam, fn) \
  183. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (CREATESTRUCT FAR*)(lParam))
  184. #define FORWARD_WM_NCCREATE(hwnd, lpCreateStruct, fn) \
  185. (BOOL)(DWORD)(fn)((hwnd), WM_NCCREATE, 0, (LPARAM)(CREATESTRUCT FAR*)(lpCreateStruct))
  186. /* void Cls_OnDestroy(HWND hwnd); */
  187. #define HANDLE_WM_DESTROY(hwnd, wParam, lParam, fn) \
  188. ((fn)(hwnd), 0L)
  189. #define FORWARD_WM_DESTROY(hwnd, fn) \
  190. (void)(fn)((hwnd), WM_DESTROY, 0, 0L)
  191. /* void Cls_OnNCDestroy(HWND hwnd); */
  192. #define HANDLE_WM_NCDESTROY(hwnd, wParam, lParam, fn) \
  193. ((fn)(hwnd), 0L)
  194. #define FORWARD_WM_NCDESTROY(hwnd, fn) \
  195. (void)(fn)((hwnd), WM_NCDESTROY, 0, 0L)
  196. /* void Cls_OnShowWindow(HWND hwnd, BOOL fShow, UINT status); */
  197. #define HANDLE_WM_SHOWWINDOW(hwnd, wParam, lParam, fn) \
  198. ((fn)((hwnd), (BOOL)(wParam), LOWORD(lParam)), 0L)
  199. #define FORWARD_WM_SHOWWINDOW(hwnd, fShow, status, fn) \
  200. (void)(fn)((hwnd), WM_SHOWWINDOW, (WPARAM)(BOOL)(fShow), MAKELPARAM((UINT)(status), 0))
  201. /* void Cls_OnSetRedraw(HWND hwnd, BOOL fRedraw); */
  202. #define HANDLE_WM_SETREDRAW(hwnd, wParam, lParam, fn) \
  203. ((fn)((hwnd), (BOOL)(wParam)), 0L)
  204. #define FORWARD_WM_SETREDRAW(hwnd, fRedraw, fn) \
  205. (void)(fn)((hwnd), WM_SETREDRAW, (WPARAM)(fRedraw), 0L)
  206. /* void Cls_OnEnable(HWND hwnd, BOOL fEnable); */
  207. #define HANDLE_WM_ENABLE(hwnd, wParam, lParam, fn) \
  208. ((fn)((hwnd), (BOOL)(wParam)), 0L)
  209. #define FORWARD_WM_ENABLE(hwnd, fEnable, fn) \
  210. (void)(fn)((hwnd), WM_ENABLE, (WPARAM)(BOOL)(fEnable), 0L)
  211. /* void Cls_OnSetText(HWND hwnd, LPCSTR lpszText); */
  212. #define HANDLE_WM_SETTEXT(hwnd, wParam, lParam, fn) \
  213. ((fn)((hwnd), (LPCSTR)(lParam)), 0L)
  214. #define FORWARD_WM_SETTEXT(hwnd, lpszText, fn) \
  215. (void)(fn)((hwnd), WM_SETTEXT, 0, (LPARAM)(LPCSTR)(lpszText))
  216. /* INT Cls_OnGetText(HWND hwnd, int cchTextMax, LPSTR lpszText) */
  217. #define HANDLE_WM_GETTEXT(hwnd, wParam, lParam, fn) \
  218. (LRESULT)(DWORD)(int)(fn)((hwnd), (int)(wParam), (LPSTR)(lParam))
  219. #define FORWARD_WM_GETTEXT(hwnd, cchTextMax, lpszText, fn) \
  220. (int)(DWORD)(fn)((hwnd), WM_GETTEXT, (WPARAM)(int)(cchTextMax), (LPARAM)(LPSTR)(lpszText))
  221. /* INT Cls_OnGetTextLength(HWND hwnd); */
  222. #define HANDLE_WM_GETTEXTLENGTH(hwnd, wParam, lParam, fn) \
  223. (LRESULT)(DWORD)(int)(fn)(hwnd)
  224. #define FORWARD_WM_GETTEXTLENGTH(hwnd, fn) \
  225. (int)(DWORD)(fn)((hwnd), WM_GETTEXTLENGTH, 0, 0L)
  226. /* BOOL Cls_OnWindowPosChanging(HWND hwnd, WINDOWPOS FAR* lpwpos); */
  227. #define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \
  228. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (WINDOWPOS FAR*)(lParam))
  229. #define FORWARD_WM_WINDOWPOSCHANGING(hwnd, lpwpos, fn) \
  230. (BOOL)(DWORD)(fn)((hwnd), WM_WINDOWPOSCHANGING, 0, (LPARAM)(WINDOWPOS FAR*)(lpwpos))
  231. /* void Cls_OnWindowPosChanged(HWND hwnd, const WINDOWPOS FAR* lpwpos); */
  232. #define HANDLE_WM_WINDOWPOSCHANGED(hwnd, wParam, lParam, fn) \
  233. ((fn)((hwnd), (const WINDOWPOS FAR*)(lParam)), 0L)
  234. #define FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, fn) \
  235. (void)(fn)((hwnd), WM_WINDOWPOSCHANGED, 0, (LPARAM)(const WINDOWPOS FAR*)(lpwpos))
  236. /* void Cls_OnMove(HWND hwnd, int x, int y); */
  237. #define HANDLE_WM_MOVE(hwnd, wParam, lParam, fn) \
  238. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam)), 0L)
  239. #define FORWARD_WM_MOVE(hwnd, x, y, fn) \
  240. (void)(fn)((hwnd), WM_MOVE, 0, MAKELPARAM((int)(x), (int)(y)))
  241. /* void Cls_OnSize(HWND hwnd, UINT state, int cx, int cy); */
  242. #define HANDLE_WM_SIZE(hwnd, wParam, lParam, fn) \
  243. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam), (int)HIWORD(lParam)), 0L)
  244. #define FORWARD_WM_SIZE(hwnd, state, cx, cy, fn) \
  245. (void)(fn)((hwnd), WM_SIZE, (WPARAM)(UINT)(state), MAKELPARAM((int)(cx), (int)(cy)))
  246. /* void Cls_OnClose(HWND hwnd); */
  247. #define HANDLE_WM_CLOSE(hwnd, wParam, lParam, fn) \
  248. ((fn)(hwnd), 0L)
  249. #define FORWARD_WM_CLOSE(hwnd, fn) \
  250. (void)(fn)((hwnd), WM_CLOSE, 0, 0L)
  251. /* BOOL Cls_OnQueryOpen(HWND hwnd); */
  252. #define HANDLE_WM_QUERYOPEN(hwnd, wParam, lParam, fn) \
  253. MAKELRESULT((BOOL)(fn)(hwnd), 0)
  254. #define FORWARD_WM_QUERYOPEN(hwnd, fn) \
  255. (BOOL)(DWORD)(fn)((hwnd), WM_QUERYOPEN, 0, 0L)
  256. /* void Cls_OnGetMinMaxInfo(HWND hwnd, MINMAXINFO FAR* lpMinMaxInfo); */
  257. #define HANDLE_WM_GETMINMAXINFO(hwnd, wParam, lParam, fn) \
  258. ((fn)((hwnd), (MINMAXINFO FAR*)(lParam)), 0L)
  259. #define FORWARD_WM_GETMINMAXINFO(hwnd, lpMinMaxInfo, fn) \
  260. (void)(fn)((hwnd), WM_GETMINMAXINFO, 0, (LPARAM)(MINMAXINFO FAR*)(lpMinMaxInfo))
  261. /* void Cls_OnPaint(HWND hwnd); */
  262. #define HANDLE_WM_PAINT(hwnd, wParam, lParam, fn) \
  263. ((fn)(hwnd), 0L)
  264. #define FORWARD_WM_PAINT(hwnd, fn) \
  265. (void)(fn)((hwnd), WM_PAINT, 0, 0L)
  266. /* BOOL Cls_OnEraseBkgnd(HWND hwnd, HDC hdc); */
  267. #define HANDLE_WM_ERASEBKGND(hwnd, wParam, lParam, fn) \
  268. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
  269. #define FORWARD_WM_ERASEBKGND(hwnd, hdc, fn) \
  270. (BOOL)(DWORD)(fn)((hwnd), WM_ERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
  271. /* BOOL Cls_OnIconEraseBkgnd(HWND hwnd, HDC hdc); */
  272. #define HANDLE_WM_ICONERASEBKGND(hwnd, wParam, lParam, fn) \
  273. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
  274. #define FORWARD_WM_ICONERASEBKGND(hwnd, hdc, fn) \
  275. (BOOL)(DWORD)(fn)((hwnd), WM_ICONERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
  276. /* void Cls_OnNCPaint(HWND hwnd, HRGN hrgn); */
  277. #define HANDLE_WM_NCPAINT(hwnd, wParam, lParam, fn) \
  278. ((fn)((hwnd), (HRGN)(wParam)), 0L)
  279. #define FORWARD_WM_NCPAINT(hwnd, hrgn, fn) \
  280. (void)(fn)((hwnd), WM_NCPAINT, (WPARAM)(HRGN)(hrgn), 0L)
  281. /* UINT Cls_OnNCCalcSize(HWND hwnd, BOOL fCalcValidRects, NCCALCSIZE_PARAMS FAR* lpcsp) */
  282. #define HANDLE_WM_NCCALCSIZE(hwnd, wParam, lParam, fn) \
  283. (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(wParam), (NCCALCSIZE_PARAMS FAR*)(lParam))
  284. #define FORWARD_WM_NCCALCSIZE(hwnd, fCalcValidRects, lpcsp, fn) \
  285. (UINT)(DWORD)(fn)((hwnd), WM_NCCALCSIZE, (WPARAM)(fCalcValidRects), (LPARAM)(NCCALCSIZE_PARAMS FAR*)(lpcsp))
  286. /* UINT Cls_OnNCHitTest(HWND hwnd, int x, int y); */
  287. #define HANDLE_WM_NCHITTEST(hwnd, wParam, lParam, fn) \
  288. (LRESULT)(DWORD)(UINT)(fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam))
  289. #define FORWARD_WM_NCHITTEST(hwnd, x, y, fn) \
  290. (UINT)(DWORD)(fn)((hwnd), WM_NCHITTEST, 0, MAKELPARAM((int)(x), (int)(y)))
  291. /* HICON Cls_OnQueryDragIcon(HWND hwnd); */
  292. #define HANDLE_WM_QUERYDRAGICON(hwnd, wParam, lParam, fn) \
  293. (LRESULT)(DWORD)(UINT)(fn)(hwnd)
  294. #define FORWARD_WM_QUERYDRAGICON(hwnd, fn) \
  295. (HICON)(UINT)(DWORD)(fn)((hwnd), WM_QUERYDRAGICON, 0, 0L)
  296. #ifdef _INC_SHELLAPI
  297. /* void Cls_OnDropFiles(HWND hwnd, HDROP hdrop); */
  298. #define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \
  299. ((fn)((hwnd), (HDROP)(wParam)), 0L)
  300. #define FORWARD_WM_DROPFILES(hwnd, hdrop, fn) \
  301. (void)(fn)((hwnd), WM_DROPFILES, (WPARAM)(hdrop), 0L)
  302. #endif /* _INC_SHELLAPI */
  303. /* void Cls_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized); */
  304. #define HANDLE_WM_ACTIVATE(hwnd, wParam, lParam, fn) \
  305. ((fn)((hwnd), (UINT)(wParam), (HWND)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
  306. #define FORWARD_WM_ACTIVATE(hwnd, state, hwndActDeact, fMinimized, fn) \
  307. (void)(fn)((hwnd), WM_ACTIVATE, (WPARAM)(UINT)(state), MAKELPARAM((UINT)(HWND)(hwndActDeact), (UINT)(BOOL)(fMinimized)))
  308. /* void Cls_OnActivateApp(HWND hwnd, BOOL fActivate, HTASK htaskActDeact); */
  309. #define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \
  310. ((fn)((hwnd), (BOOL)(wParam), (HTASK)LOWORD(lParam)), 0L)
  311. #define FORWARD_WM_ACTIVATEAPP(hwnd, fActivate, htaskActDeact, fn) \
  312. (void)(fn)((hwnd), WM_ACTIVATEAPP, (WPARAM)(BOOL)(fActivate), MAKELPARAM((htaskActDeact),0))
  313. /* BOOL Cls_OnNCActivate(HWND hwnd, BOOL fActive, HWND hwndActDeact, BOOL fMinimized); */
  314. #define HANDLE_WM_NCACTIVATE(hwnd, wParam, lParam, fn) \
  315. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (BOOL)(wParam), (HWND)LOWORD(lParam), (BOOL)HIWORD(lParam))
  316. #define FORWARD_WM_NCACTIVATE(hwnd, fActive, hwndActDeact, fMinimized, fn) \
  317. (BOOL)(DWORD)(fn)((hwnd), WM_NCACTIVATE, (WPARAM)(BOOL)(fActive), MAKELPARAM((UINT)(HWND)(hwndActDeact), (UINT)(BOOL)(fMinimized)))
  318. /* void Cls_OnSetFocus(HWND hwnd, HWND hwndOldFocus) */
  319. #define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \
  320. ((fn)((hwnd), (HWND)(wParam)), 0L)
  321. #define FORWARD_WM_SETFOCUS(hwnd, hwndOldFocus, fn) \
  322. (void)(fn)((hwnd), WM_SETFOCUS, (WPARAM)(HWND)(hwndOldFocus), 0L)
  323. /* void Cls_OnKillFocus(HWND hwnd, HWND hwndNewFocus); */
  324. #define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \
  325. ((fn)((hwnd), (HWND)(wParam)), 0L)
  326. #define FORWARD_WM_KILLFOCUS(hwnd, hwndNewFocus, fn) \
  327. (void)(fn)((hwnd), WM_KILLFOCUS, (WPARAM)(HWND)(hwndNewFocus), 0L)
  328. /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags); */
  329. #define HANDLE_WM_KEYDOWN(hwnd, wParam, lParam, fn) \
  330. ((fn)((hwnd), (UINT)(wParam), TRUE, (int)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  331. #define FORWARD_WM_KEYDOWN(hwnd, vk, cRepeat, flags, fn) \
  332. (void)(fn)((hwnd), WM_KEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((UINT)(cRepeat), (UINT)(flags)))
  333. /* void Cls_OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags); */
  334. #define HANDLE_WM_KEYUP(hwnd, wParam, lParam, fn) \
  335. ((fn)((hwnd), (UINT)(wParam), FALSE, (int)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  336. #define FORWARD_WM_KEYUP(hwnd, vk, cRepeat, flags, fn) \
  337. (void)(fn)((hwnd), WM_KEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((UINT)(cRepeat), (UINT)(flags)))
  338. /* void Cls_OnChar(HWND hwnd, UINT ch, int cRepeat); */
  339. #define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \
  340. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  341. #define FORWARD_WM_CHAR(hwnd, ch, cRepeat, fn) \
  342. (void)(fn)((hwnd), WM_CHAR, (WPARAM)(UINT)(ch), MAKELPARAM((UINT)(cRepeat),0))
  343. /* void Cls_OnDeadChar(HWND hwnd, UINT ch, int cRepeat); */
  344. #define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \
  345. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  346. #define FORWARD_WM_DEADCHAR(hwnd, ch, cRepeat, fn) \
  347. (void)(fn)((hwnd), WM_DEADCHAR, (WPARAM)(UINT)(ch), MAKELPARAM((UINT)(cRepeat),0))
  348. /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags); */
  349. #define HANDLE_WM_SYSKEYDOWN(hwnd, wParam, lParam, fn) \
  350. ((fn)((hwnd), (UINT)(wParam), TRUE, (int)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  351. #define FORWARD_WM_SYSKEYDOWN(hwnd, vk, cRepeat, flags, fn) \
  352. (void)(fn)((hwnd), WM_SYSKEYDOWN, (WPARAM)(UINT)(vk), MAKELPARAM((UINT)(cRepeat), (UINT)(flags)))
  353. /* void Cls_OnSysKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags); */
  354. #define HANDLE_WM_SYSKEYUP(hwnd, wParam, lParam, fn) \
  355. ((fn)((hwnd), (UINT)(wParam), FALSE, (int)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  356. #define FORWARD_WM_SYSKEYUP(hwnd, vk, cRepeat, flags, fn) \
  357. (void)(fn)((hwnd), WM_SYSKEYUP, (WPARAM)(UINT)(vk), MAKELPARAM((UINT)(cRepeat), (UINT)(flags)))
  358. /* void Cls_OnSysChar(HWND hwnd, UINT ch, int cRepeat); */
  359. #define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \
  360. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  361. #define FORWARD_WM_SYSCHAR(hwnd, ch, cRepeat, fn) \
  362. (void)(fn)((hwnd), WM_SYSCHAR, (WPARAM)(UINT)(ch), MAKELPARAM((UINT)(cRepeat), 0))
  363. /* void Cls_OnSysDeadChar(HWND hwnd, UINT ch, int cRepeat); */
  364. #define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \
  365. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  366. #define FORWARD_WM_SYSDEADCHAR(hwnd, ch, cRepeat, fn) \
  367. (void)(fn)((hwnd), WM_SYSDEADCHAR, (WPARAM)(UINT)(ch), MAKELPARAM((UINT)(cRepeat), 0))
  368. /* void Cls_OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags); */
  369. #define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \
  370. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  371. #define FORWARD_WM_MOUSEMOVE(hwnd, x, y, keyFlags, fn) \
  372. (void)(fn)((hwnd), WM_MOUSEMOVE, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  373. /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  374. #define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \
  375. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  376. #define FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
  377. (void)(fn)((hwnd), (fDoubleClick) ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  378. /* void Cls_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  379. #define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  380. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  381. /* void Cls_OnLButtonUp(HWND hwnd, int x, int y, UINT keyFlags); */
  382. #define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \
  383. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  384. #define FORWARD_WM_LBUTTONUP(hwnd, x, y, keyFlags, fn) \
  385. (void)(fn)((hwnd), WM_LBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  386. /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  387. #define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \
  388. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  389. #define FORWARD_WM_RBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
  390. (void)(fn)((hwnd), (fDoubleClick) ? WM_RBUTTONDBLCLK : WM_RBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  391. /* void Cls_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  392. #define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  393. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  394. /* void Cls_OnRButtonUp(HWND hwnd, int x, int y, UINT flags); */
  395. #define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \
  396. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  397. #define FORWARD_WM_RBUTTONUP(hwnd, x, y, keyFlags, fn) \
  398. (void)(fn)((hwnd), WM_RBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  399. /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  400. #define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \
  401. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  402. #define FORWARD_WM_MBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
  403. (void)(fn)((hwnd), (fDoubleClick) ? WM_MBUTTONDBLCLK : WM_MBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  404. /* void Cls_OnMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags); */
  405. #define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  406. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  407. /* void Cls_OnMButtonUp(HWND hwnd, int x, int y, UINT flags); */
  408. #define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \
  409. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  410. #define FORWARD_WM_MBUTTONUP(hwnd, x, y, keyFlags, fn) \
  411. (void)(fn)((hwnd), WM_MBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
  412. /* void Cls_OnNCMouseMove(HWND hwnd, int x, int y, UINT codeHitTest); */
  413. #define HANDLE_WM_NCMOUSEMOVE(hwnd, wParam, lParam, fn) \
  414. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  415. #define FORWARD_WM_NCMOUSEMOVE(hwnd, x, y, codeHitTest, fn) \
  416. (void)(fn)((hwnd), WM_NCMOUSEMOVE, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
  417. /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  418. #define HANDLE_WM_NCLBUTTONDOWN(hwnd, wParam, lParam, fn) \
  419. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  420. #define FORWARD_WM_NCLBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
  421. (void)(fn)((hwnd), (fDoubleClick) ? WM_NCLBUTTONDBLCLK : WM_NCLBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)))
  422. /* void Cls_OnNCLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  423. #define HANDLE_WM_NCLBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  424. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  425. /* void Cls_OnNCLButtonUp(HWND hwnd, int x, int y, UINT codeHitTest); */
  426. #define HANDLE_WM_NCLBUTTONUP(hwnd, wParam, lParam, fn) \
  427. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  428. #define FORWARD_WM_NCLBUTTONUP(hwnd, x, y, codeHitTest, fn) \
  429. (void)(fn)((hwnd), WM_NCLBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
  430. /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  431. #define HANDLE_WM_NCRBUTTONDOWN(hwnd, wParam, lParam, fn) \
  432. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  433. #define FORWARD_WM_NCRBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
  434. (void)(fn)((hwnd), (fDoubleClick) ? WM_NCRBUTTONDBLCLK : WM_NCRBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
  435. /* void Cls_OnNCRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  436. #define HANDLE_WM_NCRBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  437. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  438. /* void Cls_OnNCRButtonUp(HWND hwnd, int x, int y, UINT codeHitTest); */
  439. #define HANDLE_WM_NCRBUTTONUP(hwnd, wParam, lParam, fn) \
  440. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  441. #define FORWARD_WM_NCRBUTTONUP(hwnd, x, y, codeHitTest, fn) \
  442. (void)(fn)((hwnd), WM_NCRBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
  443. /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  444. #define HANDLE_WM_NCMBUTTONDOWN(hwnd, wParam, lParam, fn) \
  445. ((fn)((hwnd), FALSE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  446. #define FORWARD_WM_NCMBUTTONDOWN(hwnd, fDoubleClick, x, y, codeHitTest, fn) \
  447. (void)(fn)((hwnd), (fDoubleClick) ? WM_NCMBUTTONDBLCLK : WM_NCMBUTTONDOWN, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
  448. /* void Cls_OnNCMButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT codeHitTest); */
  449. #define HANDLE_WM_NCMBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
  450. ((fn)((hwnd), TRUE, (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  451. /* void Cls_OnNCMButtonUp(HWND hwnd, int x, int y, UINT codeHitTest); */
  452. #define HANDLE_WM_NCMBUTTONUP(hwnd, wParam, lParam, fn) \
  453. ((fn)((hwnd), (int)LOWORD(lParam), (int)HIWORD(lParam), (UINT)(wParam)), 0L)
  454. #define FORWARD_WM_NCMBUTTONUP(hwnd, x, y, codeHitTest, fn) \
  455. (void)(fn)((hwnd), WM_NCMBUTTONUP, (WPARAM)(UINT)(codeHitTest), MAKELPARAM((x), (y)) )
  456. /* int Cls_OnMouseActivate(HWND hwnd, HWND hwndTopLevel, UINT codeHitTest, UINT msg); */
  457. #define HANDLE_WM_MOUSEACTIVATE(hwnd, wParam, lParam, fn) \
  458. (LRESULT)(DWORD)(int)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
  459. #define FORWARD_WM_MOUSEACTIVATE(hwnd, hwndTopLevel, codeHitTest, msg, fn) \
  460. (int)(DWORD)(fn)((hwnd), WM_MOUSEACTIVATE, (WPARAM)(HWND)(hwndTopLevel), MAKELPARAM((codeHitTest), (msg)))
  461. /* void Cls_OnCancelMode(HWND hwnd); */
  462. #define HANDLE_WM_CANCELMODE(hwnd, wParam, lParam, fn) \
  463. ((fn)(hwnd), 0L)
  464. #define FORWARD_WM_CANCELMODE(hwnd, fn) \
  465. (void)(fn)((hwnd), WM_CANCELMODE, 0, 0L)
  466. /* void Cls_OnTimer(HWND hwnd, UINT id); */
  467. #define HANDLE_WM_TIMER(hwnd, wParam, lParam, fn) \
  468. ((fn)((hwnd), (UINT)(wParam)), 0L)
  469. #define FORWARD_WM_TIMER(hwnd, id, fn) \
  470. (void)(fn)((hwnd), WM_TIMER, (WPARAM)(UINT)(id), 0L)
  471. /* void Cls_OnInitMenu(HWND hwnd, HMENU hMenu); */
  472. #define HANDLE_WM_INITMENU(hwnd, wParam, lParam, fn) \
  473. ((fn)((hwnd), (HMENU)(wParam)), 0L)
  474. #define FORWARD_WM_INITMENU(hwnd, hMenu, fn) \
  475. (void)(fn)((hwnd), WM_INITMENU, (WPARAM)(HMENU)(hMenu), 0L)
  476. /* void Cls_OnInitMenuPopup(HWND hwnd, HMENU hMenu, int item, BOOL fSystemMenu); */
  477. #define HANDLE_WM_INITMENUPOPUP(hwnd, wParam, lParam, fn) \
  478. ((fn)((hwnd), (HMENU)(wParam), (int)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
  479. #define FORWARD_WM_INITMENUPOPUP(hwnd, hMenu, item, fSystemMenu, fn) \
  480. (void)(fn)((hwnd), WM_INITMENUPOPUP, (WPARAM)(HMENU)(hMenu), MAKELPARAM((item),(fSystemMenu)))
  481. /* void Cls_OnMenuSelect(HWND hwnd, HMENU hmenu, int item, HMENU hmenuPopup, UINT flags); */
  482. #define HANDLE_WM_MENUSELECT(hwnd, wParam, lParam, fn) \
  483. ((fn)((hwnd), (HMENU)HIWORD(lParam), (LOWORD(lParam) & MF_POPUP) ? 0 : (int)(wParam), \
  484. (LOWORD(lParam) & MF_POPUP) ? (HMENU)(wParam) : 0, LOWORD(lParam)), 0L)
  485. #define FORWARD_WM_MENUSELECT(hwnd, hmenu, item, hmenuPopup, flags, fn) \
  486. (void)(fn)((hwnd), WM_MENUSELECT, ((flags) & MF_POPUP) ? (WPARAM)(HMENU)(hmenuPopup) : (WPARAM)(int)(item), MAKELPARAM((flags), (hmenu)))
  487. /* DWORD Cls_OnMenuChar(HWND hwnd, UINT ch, UINT flags, HMENU hmenu); */
  488. #define HANDLE_WM_MENUCHAR(hwnd, wParam, lParam, fn) \
  489. (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam), LOWORD(lParam), (HMENU)HIWORD(lParam))
  490. #define FORWARD_WM_MENUCHAR(hwnd, ch, flags, hmenu, fn) \
  491. (DWORD)(fn)((hwnd), WM_MENUCHAR, (WPARAM)(UINT)(ch), MAKELPARAM((flags), (UINT)(hmenu)))
  492. /* void Cls_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify); */
  493. #define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \
  494. ((fn)((hwnd), (int)(wParam), (HWND)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  495. #define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \
  496. (void)(fn)((hwnd), WM_COMMAND, (WPARAM)(int)(id), MAKELPARAM((UINT)(hwndCtl), (codeNotify)))
  497. /* void Cls_OnHScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos); */
  498. #define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \
  499. ((fn)((hwnd), (HWND)HIWORD(lParam), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  500. #define FORWARD_WM_HSCROLL(hwnd, hwndCtl, code, pos, fn) \
  501. (void)(fn)((hwnd), WM_HSCROLL, (WPARAM)(UINT)(code), MAKELPARAM((pos), (UINT)(hwndCtl)))
  502. /* void Cls_OnVScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos); */
  503. #define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \
  504. ((fn)((hwnd), (HWND)HIWORD(lParam), (UINT)(wParam), (int)LOWORD(lParam)), 0L)
  505. #define FORWARD_WM_VSCROLL(hwnd, hwndCtl, code, pos, fn) \
  506. (void)(fn)((hwnd), WM_VSCROLL, (WPARAM)(UINT)(code), MAKELPARAM((pos), (UINT)(hwndCtl)))
  507. /* void Cls_OnCut(HWND hwnd); */
  508. #define HANDLE_WM_CUT(hwnd, wParam, lParam, fn) \
  509. ((fn)(hwnd), 0L)
  510. #define FORWARD_WM_CUT(hwnd, fn) \
  511. (void)(fn)((hwnd), WM_CUT, 0, 0L)
  512. /* void Cls_OnCopy(HWND hwnd); */
  513. #define HANDLE_WM_COPY(hwnd, wParam, lParam, fn) \
  514. ((fn)(hwnd), 0L)
  515. #define FORWARD_WM_COPY(hwnd, fn) \
  516. (void)(fn)((hwnd), WM_COPY, 0, 0L)
  517. /* void Cls_OnPaste(HWND hwnd); */
  518. #define HANDLE_WM_PASTE(hwnd, wParam, lParam, fn) \
  519. ((fn)(hwnd), 0L)
  520. #define FORWARD_WM_PASTE(hwnd, fn) \
  521. (void)(fn)((hwnd), WM_PASTE, 0, 0L)
  522. /* void Cls_OnClear(HWND hwnd); */
  523. #define HANDLE_WM_CLEAR(hwnd, wParam, lParam, fn) \
  524. ((fn)(hwnd), 0L)
  525. #define FORWARD_WM_CLEAR(hwnd, fn) \
  526. (void)(fn)((hwnd), WM_CLEAR, 0, 0L)
  527. /* void Cls_OnUndo(HWND hwnd); */
  528. #define HANDLE_WM_UNDO(hwnd, wParam, lParam, fn) \
  529. ((fn)(hwnd), 0L)
  530. #define FORWARD_WM_UNDO(hwnd, fn) \
  531. (void)(fn)((hwnd), WM_UNDO, 0, 0L)
  532. /* HANDLE Cls_OnRenderFormat(HWND hwnd, UINT fmt); */
  533. #define HANDLE_WM_RENDERFORMAT(hwnd, wParam, lParam, fn) \
  534. (LRESULT)(DWORD)(UINT)(HANDLE)(fn)((hwnd), (UINT)(wParam))
  535. #define FORWARD_WM_RENDERFORMAT(hwnd, fmt, fn) \
  536. (HANDLE)(UINT)(DWORD)(fn)((hwnd), WM_RENDERFORMAT, (WPARAM)(UINT)(fmt), 0L)
  537. /* void Cls_OnRenderAllFormats(HWND hwnd); */
  538. #define HANDLE_WM_RENDERALLFORMATS(hwnd, wParam, lParam, fn) \
  539. ((fn)(hwnd), 0L)
  540. #define FORWARD_WM_RENDERALLFORMATS(hwnd, fn) \
  541. (void)(fn)((hwnd), WM_RENDERALLFORMATS, 0, 0L)
  542. /* void Cls_OnDestroyClipboard(HWND hwnd); */
  543. #define HANDLE_WM_DESTROYCLIPBOARD(hwnd, wParam, lParam, fn) \
  544. ((fn)(hwnd), 0L)
  545. #define FORWARD_WM_DESTROYCLIPBOARD(hwnd, fn) \
  546. (void)(fn)((hwnd), WM_DESTROYCLIPBOARD, 0, 0L)
  547. /* void Cls_OnDrawClipboard(HWND hwnd); */
  548. #define HANDLE_WM_DRAWCLIPBOARD(hwnd, wParam, lParam, fn) \
  549. ((fn)(hwnd), 0L)
  550. #define FORWARD_WM_DRAWCLIPBOARD(hwnd, fn) \
  551. (void)(fn)((hwnd), WM_DRAWCLIPBOARD, 0, 0L)
  552. /* void Cls_OnPaintClipboard(HWND hwnd, HWND hwndCBViewer, const PAINTSTRUCT FAR* lpPaintStruct) */
  553. #define HANDLE_WM_PAINTCLIPBOARD(hwnd, wParam, lParam, fn) \
  554. ((fn)((hwnd), (HWND)(wParam), (const PAINTSTRUCT FAR*)GlobalLock((HGLOBAL)LOWORD(lParam))), GlobalUnlock((HGLOBAL)LOWORD(lParam)), 0L)
  555. #define FORWARD_WM_PAINTCLIPBOARD(hwnd, hwndCBViewer, lpPaintStruct, fn) \
  556. (void)(fn)((hwnd), WM_PAINTCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPPAINTSTRUCT)(lpPaintStruct))
  557. /* void Cls_OnSizeClipboard(HWND hwnd, HWND hwndCBViewer, const RECT FAR* lprc); */
  558. #define HANDLE_WM_SIZECLIPBOARD(hwnd, wParam, lParam, fn) \
  559. ((fn)((hwnd), (HWND)(wParam), (const RECT FAR*)GlobalLock((HGLOBAL)LOWORD(lParam))), GlobalUnlock((HGLOBAL)LOWORD(lParam)), 0L)
  560. #define FORWARD_WM_SIZECLIPBOARD(hwnd, hwndCBViewer, lprc, fn) \
  561. (void)(fn)((hwnd), WM_SIZECLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), (LPARAM)(LPRECT)(lprc))
  562. /* void Cls_OnVScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos); */
  563. #define HANDLE_WM_VSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
  564. ((fn)((hwnd), (HWND)(wParam), LOWORD(lParam), (int)HIWORD(lParam)), 0L)
  565. #define FORWARD_WM_VSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
  566. (void)(fn)((hwnd), WM_VSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
  567. /* void Cls_OnHScrollClipboard(HWND hwnd, HWND hwndCBViewer, UINT code, int pos); */
  568. #define HANDLE_WM_HSCROLLCLIPBOARD(hwnd, wParam, lParam, fn) \
  569. ((fn)((hwnd), (HWND)(wParam), LOWORD(lParam), (int)HIWORD(lParam)), 0L)
  570. #define FORWARD_WM_HSCROLLCLIPBOARD(hwnd, hwndCBViewer, code, pos, fn) \
  571. (void)(fn)((hwnd), WM_HSCROLLCLIPBOARD, (WPARAM)(HWND)(hwndCBViewer), MAKELPARAM((code), (pos)))
  572. /* void Cls_OnAskCBFormatName(HWND hwnd, int cchMax, LPSTR rgchName); */
  573. #define HANDLE_WM_ASKCBFORMATNAME(hwnd, wParam, lParam, fn) \
  574. ((fn)((hwnd), (int)(wParam), (LPSTR)(lParam)), 0L)
  575. #define FORWARD_WM_ASKCBFORMATNAME(hwnd, cchMax, rgchName, fn) \
  576. (void)(fn)((hwnd), WM_ASKCBFORMATNAME, (WPARAM)(int)(cchMax), (LPARAM)(rgchName))
  577. /* void Cls_OnChangeCBChain(HWND hwnd, HWND hwndRemove, HWND hwndNext); */
  578. #define HANDLE_WM_CHANGECBCHAIN(hwnd, wParam, lParam, fn) \
  579. ((fn)((hwnd), (HWND)(wParam), (HWND)LOWORD(lParam)), 0L)
  580. #define FORWARD_WM_CHANGECBCHAIN(hwnd, hwndRemove, hwndNext, fn) \
  581. (void)(fn)((hwnd), WM_CHANGECBCHAIN, (WPARAM)(HWND)(hwndRemove), MAKELPARAM((UINT)(hwndNext), 0))
  582. /* BOOL Cls_OnSetCursor(HWND hwnd, HWND hwndCursor, UINT codeHitTest, UINT msg); */
  583. #define HANDLE_WM_SETCURSOR(hwnd, wParam, lParam, fn) \
  584. (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
  585. #define FORWARD_WM_SETCURSOR(hwnd, hwndCursor, codeHitTest, msg, fn) \
  586. (BOOL)(DWORD)(fn)((hwnd), WM_SETCURSOR, (WPARAM)(HWND)(hwndCursor), MAKELPARAM((codeHitTest), (msg)))
  587. /* void Cls_OnSysCommand(HWND hwnd, UINT cmd, int x, int y); */
  588. #define HANDLE_WM_SYSCOMMAND(hwnd, wParam, lParam, fn) \
  589. ((fn)((hwnd), (UINT)(wParam), (int)LOWORD(lParam), (int)HIWORD(lParam)), 0L)
  590. #define FORWARD_WM_SYSCOMMAND(hwnd, cmd, x, y, fn) \
  591. (void)(fn)((hwnd), WM_SYSCOMMAND, (WPARAM)(UINT)(cmd), MAKELPARAM((x), (y)))
  592. /* HWND Cls_MDICreate(HWND hwnd, const MDICREATESTRUCT FAR* lpmcs); */
  593. #define HANDLE_WM_MDICREATE(hwnd, wParam, lParam, fn) \
  594. (LRESULT)(DWORD)(UINT)(fn)((hwnd), (MDICREATESTRUCT FAR*)(lParam))
  595. #define FORWARD_WM_MDICREATE(hwnd, lpmcs, fn) \
  596. (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDICREATE, 0, (LPARAM)(LPMDICREATESTRUCT)(lpmcs))
  597. /* void Cls_MDIDestroy(HWND hwnd, HWND hwndDestroy); */
  598. #define HANDLE_WM_MDIDESTROY(hwnd, wParam, lParam, fn) \
  599. ((fn)((hwnd), (HWND)(wParam)), 0L)
  600. #define FORWARD_WM_MDIDESTROY(hwnd, hwndDestroy, fn) \
  601. (void)(fn)((hwnd), WM_MDIDESTROY, (WPARAM)(hwndDestroy), 0L)
  602. /* NOTE: Usable only by MDI client windows */
  603. /* void Cls_MDIActivate(HWND hwnd, BOOL fActive, HWND hwndActivate, HWND hwndDeactivate); */
  604. #define HANDLE_WM_MDIACTIVATE(hwnd, wParam, lParam, fn) \
  605. ((fn)((hwnd), (BOOL)(wParam), (HWND)LOWORD(lParam), (HWND)HIWORD(lParam)), 0L)
  606. #define FORWARD_WM_MDIACTIVATE(hwnd, fActive, hwndActivate, hwndDeactivate, fn) \
  607. (void)(fn)(hwnd, WM_MDIACTIVATE, (WPARAM)(fActive), MAKELPARAM((hwndActivate), (hwndDeactivate)))
  608. /* void Cls_MDIRestore(HWND hwnd, HWND hwndRestore); */
  609. #define HANDLE_WM_MDIRESTORE(hwnd, wParam, lParam, fn) \
  610. ((fn)((hwnd), (HWND)(wParam)), 0L)
  611. #define FORWARD_WM_MDIRESTORE(hwnd, hwndRestore, fn) \
  612. (void)(fn)((hwnd), WM_MDIRESTORE, (WPARAM)(hwndRestore), 0L)
  613. /* HWND Cls_MDINext(HWND hwnd, HWND hwndCur, BOOL fPrev); */
  614. #define HANDLE_WM_MDINEXT(hwnd, wParam, lParam, fn) \
  615. ((fn)((hwnd), (HWND)(wParam), (BOOL)LOWORD(lParam)), 0L)
  616. #define FORWARD_WM_MDINEXT(hwnd, hwndCur, fPrev, fn) \
  617. (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDINEXT, (WPARAM)(hwndCur), MAKELPARAM((fPrev), 0))
  618. /* void Cls_MDIMaximize(HWND hwnd, HWND hwndMaximize); */
  619. #define HANDLE_WM_MDIMAXIMIZE(hwnd, wParam, lParam, fn) \
  620. ((fn)((hwnd), (HWND)(wParam)), 0L)
  621. #define FORWARD_WM_MDIMAXIMIZE(hwnd, hwndMaximize, fn) \
  622. (void)(fn)((hwnd), WM_MDIMAXIMIZE, (WPARAM)(hwndMaximize), 0L)
  623. /* BOOL Cls_MDITile(HWND hwnd, UINT cmd); */
  624. #define HANDLE_WM_MDITILE(hwnd, wParam, lParam, fn) \
  625. (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
  626. #define FORWARD_WM_MDITILE(hwnd, cmd, fn) \
  627. (BOOL)(DWORD)(fn)((hwnd), WM_MDITILE, (WPARAM)(cmd), 0L)
  628. /* BOOL Cls_MDICascade(HWND hwnd, UINT cmd); */
  629. #define HANDLE_WM_MDICASCADE(hwnd, wParam, lParam, fn) \
  630. (LRESULT)(DWORD)(fn)((hwnd), (UINT)(wParam))
  631. #define FORWARD_WM_MDICASCADE(hwnd, cmd, fn) \
  632. (BOOL)(DWORD)(fn)((hwnd), WM_MDICASCADE, (WPARAM)(cmd), 0L)
  633. /* void Cls_MDIIconArrange(HWND hwnd); */
  634. #define HANDLE_WM_MDIICONARRANGE(hwnd, wParam, lParam, fn) \
  635. ((fn)(hwnd), 0L)
  636. #define FORWARD_WM_MDIICONARRANGE(hwnd, fn) \
  637. (void)(fn)((hwnd), WM_MDIICONARRANGE, 0, 0L)
  638. /* HWND Cls_MDIGetActive(HWND hwnd); */
  639. #define HANDLE_WM_MDIGETACTIVE(hwnd, wParam, lParam, fn) \
  640. (LRESULT)(DWORD)(UINT)(fn)(hwnd)
  641. #define FORWARD_WM_MDIGETACTIVE(hwnd, fn) \
  642. (HWND)(UINT)(DWORD)(fn)((hwnd), WM_MDIGETACTIVE, 0, 0L)
  643. /* HMENU Cls_MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow); */
  644. #define HANDLE_WM_MDISETMENU(hwnd, wParam, lParam, fn) \
  645. (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(wParam), (HMENU)LOWORD(lParam), (HMENU)HIWORD(lParam))
  646. #define FORWARD_WM_MDISETMENU(hwnd, fRefresh, hmenuFrame, hmenuWindow, fn) \
  647. (HMENU)(UINT)(DWORD)(fn)((hwnd), WM_MDISETMENU, (WPARAM)(fRefresh), MAKELPARAM((hmenuFrame), (hmenuWindow)))
  648. /* void Cls_OnChildActivate(HWND hwnd); */
  649. #define HANDLE_WM_CHILDACTIVATE(hwnd, wParam, lParam, fn) \
  650. ((fn)(hwnd), 0L)
  651. #define FORWARD_WM_CHILDACTIVATE(hwnd, fn) \
  652. (void)(fn)((hwnd), WM_CHILDACTIVATE, 0, 0L)
  653. /* BOOL Cls_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam); */
  654. #define HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, fn) \
  655. (LRESULT)(DWORD)(UINT)(BOOL)(fn)((hwnd), (HWND)(wParam), lParam)
  656. #define FORWARD_WM_INITDIALOG(hwnd, hwndFocus, lParam, fn) \
  657. (BOOL)(DWORD)(fn)((hwnd), WM_INITDIALOG, (WPARAM)(HWND)(hwndFocus), (lParam))
  658. /* HWND Cls_OnNextDlgCtl(HWND hwnd, HWND hwndSetFocus, BOOL fNext) */
  659. #define HANDLE_WM_NEXTDLGCTL(hwnd, wParam, lParam, fn) \
  660. (LRESULT)(DWORD)(UINT)(HWND)(fn)((hwnd), (HWND)(wParam), (BOOL)LOWORD(lParam))
  661. #define FORWARD_WM_NEXTDLGCTL(hwnd, hwndSetFocus, fNext, fn) \
  662. (HWND)(UINT)(DWORD)(fn)((hwnd), WM_NEXTDLGCTL, (WPARAM)(HWND)(hwndSetFocus), MAKELPARAM((fNext), 0))
  663. /* void Cls_OnParentNotify(HWND hwnd, UINT msg, HWND hwndChild, int idChild); */
  664. #define HANDLE_WM_PARENTNOTIFY(hwnd, wParam, lParam, fn) \
  665. ((fn)((hwnd), (UINT)(wParam), (HWND)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
  666. #define FORWARD_WM_PARENTNOTIFY(hwnd, msg, hwndChild, idChild, fn) \
  667. (void)(fn)((hwnd), WM_PARENTNOTIFY, (WPARAM)(UINT)(msg), MAKELPARAM((UINT)(HWND)(hwndChild), (UINT)(idChild)))
  668. /* void Cls_OnEnterIdle(HWND hwnd, UINT source, HWND hwndSource); */
  669. #define HANDLE_WM_ENTERIDLE(hwnd, wParam, lParam, fn) \
  670. ((fn)((hwnd), (UINT)(wParam), (HWND)LOWORD(lParam)), 0L)
  671. #define FORWARD_WM_ENTERIDLE(hwnd, source, hwndSource, fn) \
  672. (void)(fn)((hwnd), WM_ENTERIDLE, (WPARAM)(UINT)(source), MAKELPARAM((UINT)(HWND)(hwndSource), 0))
  673. /* UINT Cls_OnGetDlgCode(HWND hwnd, MSG FAR* lpmsg); */
  674. #define HANDLE_WM_GETDLGCODE(hwnd, wParam, lParam, fn) \
  675. (LRESULT)(DWORD)(UINT)(fn)(hwnd, (MSG FAR*)(lParam))
  676. #define FORWARD_WM_GETDLGCODE(hwnd, lpmsg, fn) \
  677. (UINT)(DWORD)(fn)((hwnd), WM_GETDLGCODE, (SELECTOROF(lpmsg) ? lpmsg->wParam : 0), (LPARAM)(LPMSG)(lpmsg))
  678. /* HBRUSH Cls_OnCtlColor(HWND hwnd, HDC hdc, HWND hwndChild, int type); */
  679. #define HANDLE_WM_CTLCOLOR(hwnd, wParam, lParam, fn) \
  680. (LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((hwnd), (HDC)(wParam), (HWND)LOWORD(lParam), (int)(HIWORD(lParam)))
  681. #define FORWARD_WM_CTLCOLOR(hwnd, hdc, hwndChild, type, fn) \
  682. (HBRUSH)(UINT)(DWORD)(fn)((hwnd), WM_CTLCOLOR, (WPARAM)(HDC)(hdc), MAKELPARAM((UINT)(HWND)(hwndChild), (UINT)(int)(type)))
  683. /* void Cls_OnSetFont(HWND hwndCtl, HFONT hfont, BOOL fRedraw); */
  684. #define HANDLE_WM_SETFONT(hwnd, wParam, lParam, fn) \
  685. ((fn)((hwnd), (HFONT)(wParam), (BOOL)LOWORD(lParam)), 0L)
  686. #define FORWARD_WM_SETFONT(hwnd, hfont, fRedraw, fn) \
  687. (void)(fn)((hwnd), WM_SETFONT, (WPARAM)(HFONT)(hfont), MAKELPARAM((UINT)(BOOL)(fRedraw), 0))
  688. /* HFONT Cls_OnGetFont(HWND hwnd); */
  689. #define HANDLE_WM_GETFONT(hwnd, wParam, lParam, fn) \
  690. (LRESULT)(DWORD)(UINT)(HFONT)(fn)(hwnd)
  691. #define FORWARD_WM_GETFONT(hwnd, fn) \
  692. (HFONT)(UINT)(DWORD)(fn)((hwnd), WM_GETFONT, 0, 0L)
  693. /* void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT FAR* lpDrawItem); */
  694. #define HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, fn) \
  695. ((fn)((hwnd), (const DRAWITEMSTRUCT FAR*)(lParam)), 0L)
  696. #define FORWARD_WM_DRAWITEM(hwnd, lpDrawItem, fn) \
  697. (void)(fn)((hwnd), WM_DRAWITEM, 0, (LPARAM)(const DRAWITEMSTRUCT FAR*)(lpDrawItem))
  698. /* void Cls_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT FAR* lpMeasureItem); */
  699. #define HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, fn) \
  700. ((fn)((hwnd), (MEASUREITEMSTRUCT FAR*)(lParam)), 0L)
  701. #define FORWARD_WM_MEASUREITEM(hwnd, lpMeasureItem, fn) \
  702. (void)(fn)((hwnd), WM_MEASUREITEM, 0, (LPARAM)(MEASUREITEMSTRUCT FAR*)(lpMeasureItem))
  703. /* void Cls_OnDeleteItem(HWND hwnd, const DELETEITEMSTRUCT FAR* lpDeleteItem) */
  704. #define HANDLE_WM_DELETEITEM(hwnd, wParam, lParam, fn) \
  705. ((fn)((hwnd), (const DELETEITEMSTRUCT FAR*)(lParam)), 0L)
  706. #define FORWARD_WM_DELETEITEM(hwnd, lpDeleteItem, fn) \
  707. (void)(fn)((hwnd), WM_DELETEITEM, 0, (LPARAM)(const DELETEITEMSTRUCT FAR*)(lpDeleteItem))
  708. /* int Cls_OnCompareItem(HWND hwnd, const COMPAREITEMSTRUCT FAR* lpCompareItem); */
  709. #define HANDLE_WM_COMPAREITEM(hwnd, wParam, lParam, fn) \
  710. (LRESULT)(DWORD)(int)(fn)((hwnd), (const COMPAREITEMSTRUCT FAR*)(lParam))
  711. #define FORWARD_WM_COMPAREITEM(hwnd, lpCompareItem, fn) \
  712. (int)(DWORD)(fn)((hwnd), WM_COMPAREITEM, 0, (LPARAM)(const COMPAREITEMSTRUCT FAR*)(lpCompareItem))
  713. /* int Cls_OnVkeyToItem(HWND hwnd, UINT vk, HWND hwndListbox, int iCaret); */
  714. #define HANDLE_WM_VKEYTOITEM(hwnd, wParam, lParam, fn) \
  715. (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)(wParam), (HWND)LOWORD(lParam), (int)HIWORD(lParam))
  716. #define FORWARD_WM_VKEYTOITEM(hwnd, vk, hwndListBox, iCaret, fn) \
  717. (int)(DWORD)(fn)((hwnd), WM_VKEYTOITEM, (WPARAM)(UINT)(vk), MAKELPARAM((UINT)(hwndListBox), (UINT)(iCaret)))
  718. /* int Cls_OnCharToItem(HWND hwnd, UINT ch, HWND hwndListbox, int iCaret); */
  719. #define HANDLE_WM_CHARTOITEM(hwnd, wParam, lParam, fn) \
  720. (LRESULT)(DWORD)(int)(fn)((hwnd), (UINT)(wParam), (HWND)LOWORD(lParam), (int)HIWORD(lParam))
  721. #define FORWARD_WM_CHARTOITEM(hwnd, ch, hwndListBox, iCaret, fn) \
  722. (int)(DWORD)(fn)((hwnd), WM_CHARTOITEM, (WPARAM)(UINT)(ch), MAKELPARAM((UINT)(hwndListBox), (UINT)(iCaret)))
  723. /* void Cls_OnQueueSync(HWND hwnd); */
  724. #define HANDLE_WM_QUEUESYNC(hwnd, wParam, lParam, fn) \
  725. ((fn)(hwnd), 0L)
  726. #define FORWARD_WM_QUEUESYNC(hwnd, fn) \
  727. (void)(fn)((hwnd), WM_QUEUESYNC, 0, 0L)
  728. /* void Cls_OnCommNotify(HWND hwnd, int cid, UINT flags); */
  729. #define HANDLE_WM_COMMNOTIFY(hwnd, wParam, lParam, fn) \
  730. ((fn)((hwnd), (int)(wParam), LOWORD(lParam)), 0L)
  731. #define FORWARD_WM_COMMNOTIFY(hwnd, cid, flags, fn) \
  732. (void)(fn)((hwnd), WM_COMMNOTIFY, (WPARAM)(cid), MAKELPARAM((flags), 0))
  733. /****** Static control message APIs ******************************************/
  734. #define Static_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
  735. #define Static_GetText(hwndCtl, lpch, cchMax) GetWindowText((hwndCtl), (lpch), (cchMax))
  736. #define Static_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
  737. #define Static_SetText(hwndCtl, lpsz) SetWindowText((hwndCtl), (lpsz))
  738. #define Static_SetIcon(hwndCtl, hIcon) ((HICON)(UINT)(DWORD)SendMessage((hwndCtl), STM_SETICON, (WPARAM)(HICON)(hIcon), 0L))
  739. #define Static_GetIcon(hwndCtl, hIcon) ((HICON)(UINT)(DWORD)SendMessage((hwndCtl), STM_GETICON, 0, 0L))
  740. /****** Button control message APIs ******************************************/
  741. #define Button_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
  742. #define Button_GetText(hwndCtl, lpch, cchMax) GetWindowText((hwndCtl), (lpch), (cchMax))
  743. #define Button_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
  744. #define Button_SetText(hwndCtl, lpsz) SetWindowText((hwndCtl), (lpsz))
  745. #define Button_GetCheck(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), BM_GETCHECK, 0, 0L))
  746. #define Button_SetCheck(hwndCtl, check) ((void)SendMessage((hwndCtl), BM_SETCHECK, (WPARAM)(int)(check), 0L))
  747. #define Button_GetState(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), BM_GETSTATE, 0, 0L))
  748. #define Button_SetState(hwndCtl, state) ((UINT)(DWORD)SendMessage((hwndCtl), BM_SETSTATE, (WPARAM)(int)(state), 0L))
  749. #define Button_SetStyle(hwndCtl, style, fRedraw) ((void)SendMessage((hwndCtl), BM_SETSTYLE, (WPARAM)LOWORD(style), MAKELPARAM(((fRedraw) ? TRUE : FALSE), 0)))
  750. /****** Edit control message APIs ********************************************/
  751. #define Edit_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
  752. #define Edit_GetText(hwndCtl, lpch, cchMax) GetWindowText((hwndCtl), (lpch), (cchMax))
  753. #define Edit_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
  754. #define Edit_SetText(hwndCtl, lpsz) SetWindowText((hwndCtl), (lpsz))
  755. #define Edit_LimitText(hwndCtl, cchMax) ((void)SendMessage((hwndCtl), EM_LIMITTEXT, (WPARAM)(cchMax), 0L))
  756. #define Edit_GetLineCount(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), EM_GETLINECOUNT, 0, 0L))
  757. #define Edit_GetLine(hwndCtl, line, lpch, cchMax) ((*((int FAR*)(lpch)) = (cchMax)), ((int)(DWORD)SendMessage((hwndCtl), EM_GETLINE, (WPARAM)(int)(line), (LPARAM)(LPSTR)(lpch))))
  758. #define Edit_GetRect(hwndCtl, lprc) ((void)SendMessage((hwndCtl), EM_GETRECT, 0, (LPARAM)(RECT FAR*)(lprc)))
  759. #define Edit_SetRect(hwndCtl, lprc) ((void)SendMessage((hwndCtl), EM_SETRECT, 0, (LPARAM)(const RECT FAR*)(lprc)))
  760. #define Edit_SetRectNoPaint(hwndCtl, lprc) ((void)SendMessage((hwndCtl), EM_SETRECTNP, 0, (LPARAM)(const RECT FAR*)(lprc)))
  761. #define Edit_GetSel(hwndCtl) ((DWORD)SendMessage((hwndCtl), EM_GETSEL, 0, 0L))
  762. #define Edit_SetSel(hwndCtl, ichStart, ichEnd) ((void)SendMessage((hwndCtl), EM_SETSEL, 0, MAKELPARAM((ichStart), (ichEnd))))
  763. #define Edit_ReplaceSel(hwndCtl, lpszReplace) ((void)SendMessage((hwndCtl), EM_REPLACESEL, 0, (LPARAM)(LPCSTR)(lpszReplace)))
  764. #define Edit_GetModify(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl), EM_GETMODIFY, 0, 0L))
  765. #define Edit_SetModify(hwndCtl, fModified) ((void)SendMessage((hwndCtl), EM_SETMODIFY, (WPARAM)(UINT)(fModified), 0L))
  766. #define Edit_LineFromChar(hwndCtl, ich) ((int)(DWORD)SendMessage((hwndCtl), EM_LINEFROMCHAR, (WPARAM)(int)(ich), 0L))
  767. #define Edit_LineIndex(hwndCtl, line) ((int)(DWORD)SendMessage((hwndCtl), EM_LINEINDEX, (WPARAM)(int)(line), 0L))
  768. #define Edit_LineLength(hwndCtl, line) ((int)(DWORD)SendMessage((hwndCtl), EM_LINELENGTH, (WPARAM)(int)(line), 0L))
  769. #define Edit_Scroll(hwndCtl, dv, dh) ((void)SendMessage((hwndCtl), EM_LINESCROLL, 0, MAKELPARAM((dv), (dh))))
  770. #define Edit_CanUndo(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl), EM_CANUNDO, 0, 0L))
  771. #define Edit_Undo(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl), EM_UNDO, 0, 0L))
  772. #define Edit_EmptyUndoBuffer(hwndCtl) ((void)SendMessage((hwndCtl), EM_EMPTYUNDOBUFFER, 0, 0L))
  773. #define Edit_SetPasswordChar(hwndCtl, ch) ((void)SendMessage((hwndCtl), EM_SETPASSWORDCHAR, (WPARAM)(UINT)(ch), 0L))
  774. #define Edit_SetTabStops(hwndCtl, cTabs, lpTabs) ((void)SendMessage((hwndCtl), EM_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(const int FAR*)(lpTabs)))
  775. #define Edit_FmtLines(hwndCtl, fAddEOL) ((BOOL)(DWORD)SendMessage((hwndCtl), EM_FMTLINES, (WPARAM)(BOOL)(fAddEOL), 0L))
  776. #define Edit_GetHandle(hwndCtl) ((HLOCAL)(UINT)(DWORD)SendMessage((hwndCtl), EM_GETHANDLE, 0, 0L))
  777. #define Edit_SetHandle(hwndCtl, h) ((void)SendMessage((hwndCtl), EM_SETHANDLE, (WPARAM)(UINT)(HLOCAL)(h), 0L))
  778. #if (WINVER >= 0x030a)
  779. #define Edit_GetFirstVisibleLine(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), EM_GETFIRSTVISIBLELINE, 0, 0L))
  780. #define Edit_SetReadOnly(hwndCtl, fReadOnly) ((BOOL)(DWORD)SendMessage((hwndCtl), EM_SETREADONLY, (WPARAM)(BOOL)(fReadOnly), 0L))
  781. #define Edit_GetPasswordChar(hwndCtl) ((char)(DWORD)SendMessage((hwndCtl), EM_GETPASSWORDCHAR, 0, 0L))
  782. #define Edit_SetWordBreakProc(hwndCtl, lpfnWordBreak) ((void)SendMessage((hwndCtl), EM_SETWORDBREAKPROC, 0, (LPARAM)(EDITWORDBREAKPROC)(lpfnWordBreak)))
  783. #define Edit_GetWordBreakProc(hwndCtl) ((EDITWORDBREAKPROC)SendMessage((hwndCtl), EM_GETWORDBREAKPROC, 0, 0L))
  784. #endif /* WINVER >= 0x030a */
  785. /****** ScrollBar control message APIs ***************************************/
  786. /* NOTE: flags parameter is a collection of ESB_* values, NOT a boolean! */
  787. #define ScrollBar_Enable(hwndCtl, flags) EnableScrollBar((hwndCtl), SB_CTL, (flags))
  788. #define ScrollBar_Show(hwndCtl, fShow) ShowWindow((hwndCtl), (fShow) ? SW_SHOWNORMAL : SW_HIDE)
  789. #define ScrollBar_SetPos(hwndCtl, pos, fRedraw) SetScrollPos((hwndCtl), SB_CTL, (pos), (fRedraw))
  790. #define ScrollBar_GetPos(hwndCtl) GetScrollPos((hwndCtl), SB_CTL)
  791. #define ScrollBar_SetRange(hwndCtl, posMin, posMax, fRedraw) SetScrollRange((hwndCtl), SB_CTL, (posMin), (posMax), (fRedraw))
  792. #define ScrollBar_GetRange(hwndCtl, lpposMin, lpposMax) GetScrollRange((hwndCtl), SB_CTL, (lpposMin), (lpposMax))
  793. /****** ListBox control message APIs *****************************************/
  794. #define ListBox_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
  795. #define ListBox_GetCount(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETCOUNT, 0, 0L))
  796. #define ListBox_ResetContent(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl), LB_RESETCONTENT, 0, 0L))
  797. #define ListBox_AddString(hwndCtl, lpsz) ((int)(DWORD)SendMessage((hwndCtl), LB_ADDSTRING, 0, (LPARAM)(LPCSTR)(lpsz)))
  798. #define ListBox_InsertString(hwndCtl, index, lpsz) ((int)(DWORD)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCSTR)(lpsz)))
  799. #define ListBox_AddItemData(hwndCtl, data) ((int)(DWORD)SendMessage((hwndCtl), LB_ADDSTRING, 0, (LPARAM)(data)))
  800. #define ListBox_InsertItemData(hwndCtl, index, data) ((int)(DWORD)SendMessage((hwndCtl), LB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(data)))
  801. #define ListBox_DeleteString(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_DELETESTRING, (WPARAM)(int)(index), 0L))
  802. #define ListBox_GetTextLen(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_GETTEXTLEN, (WPARAM)(int)(index), 0L))
  803. #define ListBox_GetText(hwndCtl, index, lpszBuffer) ((int)(DWORD)SendMessage((hwndCtl), LB_GETTEXT, (WPARAM)(int)(index), (LPARAM)(LPCSTR)(lpszBuffer)))
  804. #define ListBox_GetItemData(hwndCtl, index) ((LRESULT)(DWORD)SendMessage((hwndCtl), LB_GETITEMDATA, (WPARAM)(int)(index), 0L))
  805. #define ListBox_SetItemData(hwndCtl, index, data) ((int)(DWORD)SendMessage((hwndCtl), LB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(data)))
  806. #define ListBox_FindString(hwndCtl, indexStart, lpszFind) ((int)(DWORD)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszFind)))
  807. #define ListBox_FindItemData(hwndCtl, indexStart, data) ((int)(DWORD)SendMessage((hwndCtl), LB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
  808. #define ListBox_SetSel(hwndCtl, fSelect, index) ((int)(DWORD)SendMessage((hwndCtl), LB_SETSEL, (WPARAM)(BOOL)(fSelect), MAKELPARAM((index), 0)))
  809. #define ListBox_SelItemRange(hwndCtl, fSelect, first, last) ((int)(DWORD)SendMessage((hwndCtl), LB_SELITEMRANGE, (WPARAM)(BOOL)(fSelect), MAKELPARAM((first), (last))))
  810. #define ListBox_GetCurSel(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETCURSEL, 0, 0L))
  811. #define ListBox_SetCurSel(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_SETCURSEL, (WPARAM)(int)(index), 0L))
  812. #define ListBox_SelectString(hwndCtl, indexStart, lpszFind) ((int)(DWORD)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszFind)))
  813. #define ListBox_SelectItemData(hwndCtl, indexStart, data) ((int)(DWORD)SendMessage((hwndCtl), LB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
  814. #define ListBox_GetSel(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_GETSEL, (WPARAM)(int)(index), 0L))
  815. #define ListBox_GetSelCount(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETSELCOUNT, 0, 0L))
  816. #define ListBox_GetTopIndex(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETTOPINDEX, 0, 0L))
  817. #define ListBox_GetSelItems(hwndCtl, cItems, lpItems) ((int)(DWORD)SendMessage((hwndCtl), LB_GETSELITEMS, (WPARAM)(int)(cItems), (LPARAM)(int FAR*)(lpItems)))
  818. #define ListBox_SetTopIndex(hwndCtl, indexTop) ((int)(DWORD)SendMessage((hwndCtl), LB_SETTOPINDEX, (WPARAM)(int)(indexTop), 0L))
  819. #define ListBox_SetColumnWidth(hwndCtl, cxColumn) ((void)SendMessage((hwndCtl), LB_SETCOLUMNWIDTH, (WPARAM)(int)(cxColumn), 0L))
  820. #define ListBox_GetHorizontalExtent(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETHORIZONTALEXTENT, 0, 0L))
  821. #define ListBox_SetHorizontalExtent(hwndCtl, cxExtent) ((void)SendMessage((hwndCtl), LB_SETHORIZONTALEXTENT, (WPARAM)(int)(cxExtent), 0L))
  822. #define ListBox_SetTabStops(hwndCtl, cTabs, lpTabs) ((BOOL)(DWORD)SendMessage((hwndCtl), LB_SETTABSTOPS, (WPARAM)(int)(cTabs), (LPARAM)(int FAR*)(lpTabs)))
  823. #define ListBox_GetItemRect(hwndCtl, index, lprc) ((int)(DWORD)SendMessage((hwndCtl), LB_GETITEMRECT, (WPARAM)(int)(index), (LPARAM)(RECT FAR*)(lprc)))
  824. #define ListBox_SetCaretIndex(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_SETCARETINDEX, (WPARAM)(int)(index), 0L))
  825. #define ListBox_GetCaretIndex(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETCARETINDEX, 0, 0L))
  826. #define ListBox_SetAnchorIndex(hwndCtl, index) ((void)SendMessage((hwndCtl), LB_SETANCHORINDEX, (WPARAM)(int)(index), 0L))
  827. #define ListBox_GetAnchorIndex(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), LB_GETANCHORINDEX, 0, 0L))
  828. #if (WINVER >= 0x030a)
  829. #define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind) ((int)(DWORD)SendMessage((hwndCtl), LB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszFind)))
  830. #define ListBox_SetItemHeight(hwndCtl, index, cy) ((int)(DWORD)SendMessage((hwndCtl), LB_SETITEMHEIGHT, (WPARAM)(int)(index), MAKELPARAM((cy), 0)))
  831. #define ListBox_GetItemHeight(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), LB_GETITEMHEIGHT, (WPARAM)(int)(index), 0L))
  832. #endif /* WINVER >= 0x030a */
  833. #define ListBox_Dir(hwndCtl, attrs, lpszFileSpec) ((int)(DWORD)SendMessage((hwndCtl), LB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCSTR)(lpszFileSpec)))
  834. /****** ComboBox control message APIs ****************************************/
  835. #define ComboBox_Enable(hwndCtl, fEnable) EnableWindow((hwndCtl), (fEnable))
  836. #define ComboBox_GetText(hwndCtl, lpch, cchMax) GetWindowText((hwndCtl), (lpch), (cchMax))
  837. #define ComboBox_GetTextLength(hwndCtl) GetWindowTextLength(hwndCtl)
  838. #define ComboBox_SetText(hwndCtl, lpsz) SetWindowText((hwndCtl), (lpsz))
  839. #define ComboBox_LimitText(hwndCtl, cchLimit) ((int)(DWORD)SendMessage((hwndCtl), CB_LIMITTEXT, (WPARAM)(int)(cchLimit), 0L))
  840. #define ComboBox_GetEditSel(hwndCtl) ((DWORD)SendMessage((hwndCtl), CB_GETEDITSEL, 0, 0L))
  841. #define ComboBox_SetEditSel(hwndCtl, ichStart, ichEnd) ((int)(DWORD)SendMessage((hwndCtl), CB_SETEDITSEL, 0, MAKELPARAM((ichStart), (ichEnd))))
  842. #define ComboBox_GetCount(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), CB_GETCOUNT, 0, 0L))
  843. #define ComboBox_ResetContent(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), CB_RESETCONTENT, 0, 0L))
  844. #define ComboBox_AddString(hwndCtl, lpsz) ((int)(DWORD)SendMessage((hwndCtl), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)(lpsz)))
  845. #define ComboBox_InsertString(hwndCtl, index, lpsz) ((int)(DWORD)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(LPCSTR)(lpsz)))
  846. #define ComboBox_AddItemData(hwndCtl, data) ((int)(DWORD)SendMessage((hwndCtl), CB_ADDSTRING, 0, (LPARAM)(data)))
  847. #define ComboBox_InsertItemData(hwndCtl, index, data) ((int)(DWORD)SendMessage((hwndCtl), CB_INSERTSTRING, (WPARAM)(int)(index), (LPARAM)(data)))
  848. #define ComboBox_DeleteString(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), CB_DELETESTRING, (WPARAM)(int)(index), 0L))
  849. #define ComboBox_GetLBTextLen(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), CB_GETLBTEXTLEN, (WPARAM)(int)(index), 0L))
  850. #define ComboBox_GetLBText(hwndCtl, index, lpszBuffer) ((int)(DWORD)SendMessage((hwndCtl), CB_GETLBTEXT, (WPARAM)(int)(index), (LPARAM)(LPCSTR)(lpszBuffer)))
  851. #define ComboBox_GetItemData(hwndCtl, index) ((LRESULT)(DWORD)SendMessage((hwndCtl), CB_GETITEMDATA, (WPARAM)(int)(index), 0L))
  852. #define ComboBox_SetItemData(hwndCtl, index, data) ((int)(DWORD)SendMessage((hwndCtl), CB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(data)))
  853. #define ComboBox_FindString(hwndCtl, indexStart, lpszFind) ((int)(DWORD)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszFind)))
  854. #define ComboBox_FindItemData(hwndCtl, indexStart, data) ((int)(DWORD)SendMessage((hwndCtl), CB_FINDSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
  855. #define ComboBox_GetCurSel(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), CB_GETCURSEL, 0, 0L))
  856. #define ComboBox_SetCurSel(hwndCtl, index) ((int)(DWORD)SendMessage((hwndCtl), CB_SETCURSEL, (WPARAM)(int)(index), 0L))
  857. #define ComboBox_SelectString(hwndCtl, indexStart, lpszSelect) ((int)(DWORD)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszSelect)))
  858. #define ComboBox_SelectItemData(hwndCtl, indexStart, data) ((int)(DWORD)SendMessage((hwndCtl), CB_SELECTSTRING, (WPARAM)(int)(indexStart), (LPARAM)(data)))
  859. #define ComboBox_Dir(hwndCtl, attrs, lpszFileSpec) ((int)(DWORD)SendMessage((hwndCtl), CB_DIR, (WPARAM)(UINT)(attrs), (LPARAM)(LPCSTR)(lpszFileSpec)))
  860. #define ComboBox_ShowDropdown(hwndCtl, fShow) ((BOOL)(DWORD)SendMessage((hwndCtl), CB_SHOWDROPDOWN, (WPARAM)(BOOL)(fShow), 0L))
  861. #if (WINVER >= 0x030a)
  862. #define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind) ((int)(DWORD)SendMessage((hwndCtl), CB_FINDSTRINGEXACT, (WPARAM)(int)(indexStart), (LPARAM)(LPCSTR)(lpszFind)))
  863. #define ComboBox_GetDroppedState(hwndCtl) ((BOOL)(DWORD)SendMessage((hwndCtl), CB_GETDROPPEDSTATE, 0, 0L))
  864. #define ComboBox_GetDroppedControlRect(hwndCtl, lprc) ((void)SendMessage((hwndCtl), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)(RECT FAR*)(lprc)))
  865. #define ComboBox_GetItemHeight(hwndCtl) ((int)(DWORD)SendMessage((hwndCtl), CB_GETITEMHEIGHT, 0, 0L))
  866. #define ComboBox_SetItemHeight(hwndCtl, cyItem) ((int)(DWORD)SendMessage((hwndCtl), CB_SETITEMHEIGHT, (WPARAM)(int)(index), (LPARAM)(int)cyItem))
  867. #define ComboBox_GetExtendedUI(hwndCtl) ((UINT)(DWORD)SendMessage((hwndCtl), CB_GETEXTENDEDUI, 0, 0L))
  868. #define ComboBox_SetExtendedUI(hwndCtl, flags) ((int)(DWORD)SendMessage((hwndCtl), CB_SETEXTENDEDUI, (WPARAM)(UINT)(flags), 0L))
  869. #endif /* WINVER >= 0x030a */
  870. /****** Alternate porting layer macros ***************************************/
  871. /* USER MESSAGES: */
  872. #define GET_WPARAM(wp, lp) (wp)
  873. #define GET_LPARAM(wp, lp) (lp)
  874. #define GET_WM_ACTIVATE_STATE(wp, lp) (wp)
  875. #define GET_WM_ACTIVATE_FMINIMIZED(wp, lp) ((BOOL)HIWORD(lp))
  876. #define GET_WM_ACTIVATE_HWND(wp, lp) ((HWND)LOWORD(lp))
  877. #define GET_WM_ACTIVATE_MPS(s, fmin, hwnd) \
  878. (WPARAM)(s), (LPARAM)MAKELONG(hwnd, fmin)
  879. #define GET_WM_CHARTOITEM_CHAR(wp, lp) ((CHAR)wp)
  880. #define GET_WM_CHARTOITEM_POS(wp, lp) HIWORD(lp)
  881. #define GET_WM_CHARTOITEM_HWND(wp, lp) LOWORD(lp)
  882. #define GET_WM_CHARTOITEM_MPS(ch, pos, hwnd) \
  883. (WPARAM)ch, (LPARAM)MAKELONG(hwnd, pos)
  884. #define GET_WM_COMMAND_ID(wp, lp) (wp)
  885. #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(LOWORD(lp))
  886. #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(lp)
  887. #define GET_WM_COMMAND_MPS(id, hwnd, cmd) \
  888. (WPARAM)id, MAKELONG(hwnd, cmd)
  889. #define GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
  890. #define GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(LOWORD(lp))
  891. #define GET_WM_CTLCOLOR_TYPE(wp, lp, msg) HIWORD(lp)
  892. #define GET_WM_CTLCOLOR_MSG(type) WM_CTLCOLOR
  893. #define GET_WM_CTLCOLOR_MPS(hdc, hwnd, type) \
  894. (WPARAM)(hdc), (LPARAM)MAKELONG(hwnd, type)
  895. #define GET_WM_MENUSELECT_CMD(wp, lp) (wp)
  896. #define GET_WM_MENUSELECT_FLAGS(wp, lp) (UINT)LOWORD(lp)
  897. #define GET_WM_MENUSELECT_HMENU(wp, lp) (HMENU)(HIWORD(lp))
  898. #define GET_WM_MENUSELECT_MPS(cmd, f, hmenu) \
  899. (WPARAM)cmd, (LPARAM)MAKELONG(f, hmenu)
  900. // Note: the following are for interpreting MDI child messages.
  901. #define GET_WM_MDIACTIVATE_FACTIVATE(hwnd, wp, lp) (wp)
  902. #define GET_WM_MDIACTIVATE_HWNDDEACT(wp, lp) (HWND)HIWORD(lp)
  903. #define GET_WM_MDIACTIVATE_HWNDACTIVATE(wp, lp) (HWND)LOWORD(lp)
  904. // Note: the following is for sending to the MDI client window.
  905. #define GET_WM_MDIACTIVATE_MPS(f, hwndD, hwndA)\
  906. (WPARAM)(hwndA), 0
  907. #define GET_WM_MDISETMENU_MPS(hmenuF, hmenuW) \
  908. (WPARAM)FALSE, (LPARAM)MAKELONG(hmenuF, hmenuW)
  909. #define GET_WM_MENUCHAR_CHAR(wp, lp) (CHAR)(wp)
  910. #define GET_WM_MENUCHAR_HMENU(wp, lp) (HMENU)HIWORD(lp)
  911. #define GET_WM_MENUCHAR_FMENU(wp, lp) (BOOL)LOWORD(lp)
  912. #define GET_WM_MENUCHAR_MPS(ch, hmenu, f) \
  913. (WPARAM)ch, (LPARAM)MAKELONG(f, hmenu)
  914. #define GET_WM_PARENTNOTIFY_MSG(wp, lp) (wp)
  915. #define GET_WM_PARENTNOTIFY_ID(wp, lp) HIWORD(lp)
  916. #define GET_WM_PARENTNOTIFY_HWNDCHILD(wp, lp) (HWND)LOWORD(lp)
  917. #define GET_WM_PARENTNOTIFY_X(wp, lp) (int)LOWORD(lp)
  918. #define GET_WM_PARENTNOTIFY_Y(wp, lp) (int)HIWORD(lp)
  919. #define GET_WM_PARENTNOTIFY_MPS(msg, id, hwnd) \
  920. (WPARAM)msg, (LPARAM)MAKELONG(hwnd, id)
  921. #define GET_WM_PARENTNOTIFY2_MPS(msg, x, y) \
  922. (WPARAM)msg, (LPARAM)MAKELONG(x, y)
  923. #define GET_WM_VKEYTOITEM_CODE(wp, lp) (wp)
  924. #define GET_WM_VKEYTOITEM_ITEM(wp, lp) HIWORD(lp)
  925. #define GET_WM_VKEYTOITEM_HWND(wp, lp) (HWND)LOWORD(lp)
  926. #define GET_WM_VKEYTOITEM_MPS(code, item, hwnd) \
  927. (WPARAM)code, (LPARAM)MAKELONG(hwnd, item)
  928. #define GET_EM_SETSEL_START(wp, lp) (int)LOWORD(lp)
  929. #define GET_EM_SETSEL_END(wp, lp) (int)HIWORD(lp)
  930. #define GET_EM_SETSEL_MPS(iStart, iEnd) \
  931. (WPARAM)TRUE, MAKELONG(iStart, iEnd)
  932. #define GET_EM_LINESCROLL_MPS(vert, horz) \
  933. (WPARAM)0, (LPARAM)MAKELONG(vert, horz)
  934. #define GET_WM_CHANGECBCHAIN_HWNDNEXT(wp, lp) (HWND)LOWORD(lp)
  935. #define GET_WM_HSCROLL_CODE(wp, lp) (wp)
  936. #define GET_WM_HSCROLL_POS(wp, lp) LOWORD(lp)
  937. #define GET_WM_HSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  938. #define GET_WM_HSCROLL_MPS(code, pos, hwnd) \
  939. (WPARAM)code, (LPARAM)MAKELONG(pos, hwnd)
  940. #define GET_WM_VSCROLL_CODE(wp, lp) (wp)
  941. #define GET_WM_VSCROLL_POS(wp, lp) LOWORD(lp)
  942. #define GET_WM_VSCROLL_HWND(wp, lp) (HWND)HIWORD(lp)
  943. #define GET_WM_VSCROLL_MPS(code, pos, hwnd) \
  944. (WPARAM)code, (LPARAM)MAKELONG(pos, hwnd)
  945. #ifndef RC_INVOKED
  946. #pragma pack() /* Revert to default packing */
  947. #endif /* RC_INVOKED */
  948. #ifdef __cplusplus
  949. } /* End of extern "C" { */
  950. #endif /* __cplusplus */
  951. #endif /* !_INC_WINDOWSX */