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.

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