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.

1109 lines
62 KiB

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