atlcrack.h 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422
  1. // Windows Template Library - WTL version 10.0
  2. // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
  3. //
  4. // This file is a part of the Windows Template Library.
  5. // The use and distribution terms for this software are covered by the
  6. // Microsoft Public License (http://opensource.org/licenses/MS-PL)
  7. // which can be found in the file MS-PL.txt at the root folder.
  8. #ifndef __ATLCRACK_H__
  9. #define __ATLCRACK_H__
  10. #pragma once
  11. #ifndef __ATLAPP_H__
  12. #error atlcrack.h requires atlapp.h to be included first
  13. #endif
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // Message map macro for cracked handlers
  16. // Note about message maps with cracked handlers:
  17. // You can use BEGIN_MSG_MAP for classes that derive from CWindowImpl/CDialogImpl,
  18. // but must use BEGIN_MSG_MAP_EX for classes that don't.
  19. #define BEGIN_MSG_MAP_EX(theClass) \
  20. public: \
  21. BOOL m_bMsgHandled; \
  22. /* "handled" management for cracked handlers */ \
  23. BOOL IsMsgHandled() const \
  24. { \
  25. return m_bMsgHandled; \
  26. } \
  27. void SetMsgHandled(BOOL bHandled) \
  28. { \
  29. m_bMsgHandled = bHandled; \
  30. } \
  31. BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) _WTL_OVERRIDE \
  32. { \
  33. BOOL bOldMsgHandled = m_bMsgHandled; \
  34. BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \
  35. m_bMsgHandled = bOldMsgHandled; \
  36. return bRet; \
  37. } \
  38. BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \
  39. { \
  40. BOOL bHandled = TRUE; \
  41. (hWnd); \
  42. (uMsg); \
  43. (wParam); \
  44. (lParam); \
  45. (lResult); \
  46. (bHandled); \
  47. switch(dwMsgMapID) \
  48. { \
  49. case 0:
  50. ///////////////////////////////////////////////////////////////////////////////
  51. // Standard Windows message macros
  52. // int OnCreate(LPCREATESTRUCT lpCreateStruct)
  53. #define MSG_WM_CREATE(func) \
  54. if (uMsg == WM_CREATE) \
  55. { \
  56. this->SetMsgHandled(TRUE); \
  57. lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
  58. if(this->IsMsgHandled()) \
  59. return TRUE; \
  60. }
  61. // BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
  62. #define MSG_WM_INITDIALOG(func) \
  63. if (uMsg == WM_INITDIALOG) \
  64. { \
  65. this->SetMsgHandled(TRUE); \
  66. lResult = (LRESULT)func((HWND)wParam, lParam); \
  67. if(this->IsMsgHandled()) \
  68. return TRUE; \
  69. }
  70. // BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct)
  71. #define MSG_WM_COPYDATA(func) \
  72. if (uMsg == WM_COPYDATA) \
  73. { \
  74. this->SetMsgHandled(TRUE); \
  75. lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \
  76. if(this->IsMsgHandled()) \
  77. return TRUE; \
  78. }
  79. // void OnDestroy()
  80. #define MSG_WM_DESTROY(func) \
  81. if (uMsg == WM_DESTROY) \
  82. { \
  83. this->SetMsgHandled(TRUE); \
  84. func(); \
  85. lResult = 0; \
  86. if(this->IsMsgHandled()) \
  87. return TRUE; \
  88. }
  89. // void OnMove(CPoint ptPos)
  90. #define MSG_WM_MOVE(func) \
  91. if (uMsg == WM_MOVE) \
  92. { \
  93. this->SetMsgHandled(TRUE); \
  94. func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  95. lResult = 0; \
  96. if(this->IsMsgHandled()) \
  97. return TRUE; \
  98. }
  99. // void OnSize(UINT nType, CSize size)
  100. #define MSG_WM_SIZE(func) \
  101. if (uMsg == WM_SIZE) \
  102. { \
  103. this->SetMsgHandled(TRUE); \
  104. func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  105. lResult = 0; \
  106. if(this->IsMsgHandled()) \
  107. return TRUE; \
  108. }
  109. // void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther)
  110. #define MSG_WM_ACTIVATE(func) \
  111. if (uMsg == WM_ACTIVATE) \
  112. { \
  113. this->SetMsgHandled(TRUE); \
  114. func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \
  115. lResult = 0; \
  116. if(this->IsMsgHandled()) \
  117. return TRUE; \
  118. }
  119. // void OnSetFocus(CWindow wndOld)
  120. #define MSG_WM_SETFOCUS(func) \
  121. if (uMsg == WM_SETFOCUS) \
  122. { \
  123. this->SetMsgHandled(TRUE); \
  124. func((HWND)wParam); \
  125. lResult = 0; \
  126. if(this->IsMsgHandled()) \
  127. return TRUE; \
  128. }
  129. // void OnKillFocus(CWindow wndFocus)
  130. #define MSG_WM_KILLFOCUS(func) \
  131. if (uMsg == WM_KILLFOCUS) \
  132. { \
  133. this->SetMsgHandled(TRUE); \
  134. func((HWND)wParam); \
  135. lResult = 0; \
  136. if(this->IsMsgHandled()) \
  137. return TRUE; \
  138. }
  139. // void OnEnable(BOOL bEnable)
  140. #define MSG_WM_ENABLE(func) \
  141. if (uMsg == WM_ENABLE) \
  142. { \
  143. this->SetMsgHandled(TRUE); \
  144. func((BOOL)wParam); \
  145. lResult = 0; \
  146. if(this->IsMsgHandled()) \
  147. return TRUE; \
  148. }
  149. // void OnPaint(CDCHandle dc)
  150. #define MSG_WM_PAINT(func) \
  151. if (uMsg == WM_PAINT) \
  152. { \
  153. this->SetMsgHandled(TRUE); \
  154. func((HDC)wParam); \
  155. lResult = 0; \
  156. if(this->IsMsgHandled()) \
  157. return TRUE; \
  158. }
  159. // void OnClose()
  160. #define MSG_WM_CLOSE(func) \
  161. if (uMsg == WM_CLOSE) \
  162. { \
  163. this->SetMsgHandled(TRUE); \
  164. func(); \
  165. lResult = 0; \
  166. if(this->IsMsgHandled()) \
  167. return TRUE; \
  168. }
  169. // BOOL OnQueryEndSession(UINT nSource, UINT uLogOff)
  170. #define MSG_WM_QUERYENDSESSION(func) \
  171. if (uMsg == WM_QUERYENDSESSION) \
  172. { \
  173. this->SetMsgHandled(TRUE); \
  174. lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \
  175. if(this->IsMsgHandled()) \
  176. return TRUE; \
  177. }
  178. // BOOL OnQueryOpen()
  179. #define MSG_WM_QUERYOPEN(func) \
  180. if (uMsg == WM_QUERYOPEN) \
  181. { \
  182. this->SetMsgHandled(TRUE); \
  183. lResult = (LRESULT)func(); \
  184. if(this->IsMsgHandled()) \
  185. return TRUE; \
  186. }
  187. // BOOL OnEraseBkgnd(CDCHandle dc)
  188. #define MSG_WM_ERASEBKGND(func) \
  189. if (uMsg == WM_ERASEBKGND) \
  190. { \
  191. this->SetMsgHandled(TRUE); \
  192. lResult = (LRESULT)func((HDC)wParam); \
  193. if(this->IsMsgHandled()) \
  194. return TRUE; \
  195. }
  196. // void OnSysColorChange()
  197. #define MSG_WM_SYSCOLORCHANGE(func) \
  198. if (uMsg == WM_SYSCOLORCHANGE) \
  199. { \
  200. this->SetMsgHandled(TRUE); \
  201. func(); \
  202. lResult = 0; \
  203. if(this->IsMsgHandled()) \
  204. return TRUE; \
  205. }
  206. // void OnEndSession(BOOL bEnding, UINT uLogOff)
  207. #define MSG_WM_ENDSESSION(func) \
  208. if (uMsg == WM_ENDSESSION) \
  209. { \
  210. this->SetMsgHandled(TRUE); \
  211. func((BOOL)wParam, (UINT)lParam); \
  212. lResult = 0; \
  213. if(this->IsMsgHandled()) \
  214. return TRUE; \
  215. }
  216. // void OnShowWindow(BOOL bShow, UINT nStatus)
  217. #define MSG_WM_SHOWWINDOW(func) \
  218. if (uMsg == WM_SHOWWINDOW) \
  219. { \
  220. this->SetMsgHandled(TRUE); \
  221. func((BOOL)wParam, (int)lParam); \
  222. lResult = 0; \
  223. if(this->IsMsgHandled()) \
  224. return TRUE; \
  225. }
  226. // HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit)
  227. #define MSG_WM_CTLCOLOREDIT(func) \
  228. if (uMsg == WM_CTLCOLOREDIT) \
  229. { \
  230. this->SetMsgHandled(TRUE); \
  231. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  232. if(this->IsMsgHandled()) \
  233. return TRUE; \
  234. }
  235. // HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox)
  236. #define MSG_WM_CTLCOLORLISTBOX(func) \
  237. if (uMsg == WM_CTLCOLORLISTBOX) \
  238. { \
  239. this->SetMsgHandled(TRUE); \
  240. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  241. if(this->IsMsgHandled()) \
  242. return TRUE; \
  243. }
  244. // HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button)
  245. #define MSG_WM_CTLCOLORBTN(func) \
  246. if (uMsg == WM_CTLCOLORBTN) \
  247. { \
  248. this->SetMsgHandled(TRUE); \
  249. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  250. if(this->IsMsgHandled()) \
  251. return TRUE; \
  252. }
  253. // HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd)
  254. #define MSG_WM_CTLCOLORDLG(func) \
  255. if (uMsg == WM_CTLCOLORDLG) \
  256. { \
  257. this->SetMsgHandled(TRUE); \
  258. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  259. if(this->IsMsgHandled()) \
  260. return TRUE; \
  261. }
  262. // HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
  263. #define MSG_WM_CTLCOLORSCROLLBAR(func) \
  264. if (uMsg == WM_CTLCOLORSCROLLBAR) \
  265. { \
  266. this->SetMsgHandled(TRUE); \
  267. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  268. if(this->IsMsgHandled()) \
  269. return TRUE; \
  270. }
  271. // HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic)
  272. #define MSG_WM_CTLCOLORSTATIC(func) \
  273. if (uMsg == WM_CTLCOLORSTATIC) \
  274. { \
  275. this->SetMsgHandled(TRUE); \
  276. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  277. if(this->IsMsgHandled()) \
  278. return TRUE; \
  279. }
  280. // void OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
  281. #define MSG_WM_SETTINGCHANGE(func) \
  282. if (uMsg == WM_SETTINGCHANGE) \
  283. { \
  284. this->SetMsgHandled(TRUE); \
  285. func((UINT)wParam, (LPCTSTR)lParam); \
  286. lResult = 0; \
  287. if(this->IsMsgHandled()) \
  288. return TRUE; \
  289. }
  290. // void OnDevModeChange(LPCTSTR lpDeviceName)
  291. #define MSG_WM_DEVMODECHANGE(func) \
  292. if (uMsg == WM_DEVMODECHANGE) \
  293. { \
  294. this->SetMsgHandled(TRUE); \
  295. func((LPCTSTR)lParam); \
  296. lResult = 0; \
  297. if(this->IsMsgHandled()) \
  298. return TRUE; \
  299. }
  300. // void OnActivateApp(BOOL bActive, DWORD dwThreadID)
  301. #define MSG_WM_ACTIVATEAPP(func) \
  302. if (uMsg == WM_ACTIVATEAPP) \
  303. { \
  304. this->SetMsgHandled(TRUE); \
  305. func((BOOL)wParam, (DWORD)lParam); \
  306. lResult = 0; \
  307. if(this->IsMsgHandled()) \
  308. return TRUE; \
  309. }
  310. // void OnFontChange()
  311. #define MSG_WM_FONTCHANGE(func) \
  312. if (uMsg == WM_FONTCHANGE) \
  313. { \
  314. this->SetMsgHandled(TRUE); \
  315. func(); \
  316. lResult = 0; \
  317. if(this->IsMsgHandled()) \
  318. return TRUE; \
  319. }
  320. // void OnTimeChange()
  321. #define MSG_WM_TIMECHANGE(func) \
  322. if (uMsg == WM_TIMECHANGE) \
  323. { \
  324. this->SetMsgHandled(TRUE); \
  325. func(); \
  326. lResult = 0; \
  327. if(this->IsMsgHandled()) \
  328. return TRUE; \
  329. }
  330. // void OnCancelMode()
  331. #define MSG_WM_CANCELMODE(func) \
  332. if (uMsg == WM_CANCELMODE) \
  333. { \
  334. this->SetMsgHandled(TRUE); \
  335. func(); \
  336. lResult = 0; \
  337. if(this->IsMsgHandled()) \
  338. return TRUE; \
  339. }
  340. // BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message)
  341. #define MSG_WM_SETCURSOR(func) \
  342. if (uMsg == WM_SETCURSOR) \
  343. { \
  344. this->SetMsgHandled(TRUE); \
  345. lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
  346. if(this->IsMsgHandled()) \
  347. return TRUE; \
  348. }
  349. // int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
  350. #define MSG_WM_MOUSEACTIVATE(func) \
  351. if (uMsg == WM_MOUSEACTIVATE) \
  352. { \
  353. this->SetMsgHandled(TRUE); \
  354. lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
  355. if(this->IsMsgHandled()) \
  356. return TRUE; \
  357. }
  358. // void OnChildActivate()
  359. #define MSG_WM_CHILDACTIVATE(func) \
  360. if (uMsg == WM_CHILDACTIVATE) \
  361. { \
  362. this->SetMsgHandled(TRUE); \
  363. func(); \
  364. lResult = 0; \
  365. if(this->IsMsgHandled()) \
  366. return TRUE; \
  367. }
  368. // void OnGetMinMaxInfo(LPMINMAXINFO lpMMI)
  369. #define MSG_WM_GETMINMAXINFO(func) \
  370. if (uMsg == WM_GETMINMAXINFO) \
  371. { \
  372. this->SetMsgHandled(TRUE); \
  373. func((LPMINMAXINFO)lParam); \
  374. lResult = 0; \
  375. if(this->IsMsgHandled()) \
  376. return TRUE; \
  377. }
  378. // void OnIconEraseBkgnd(CDCHandle dc)
  379. #define MSG_WM_ICONERASEBKGND(func) \
  380. if (uMsg == WM_ICONERASEBKGND) \
  381. { \
  382. this->SetMsgHandled(TRUE); \
  383. func((HDC)wParam); \
  384. lResult = 0; \
  385. if(this->IsMsgHandled()) \
  386. return TRUE; \
  387. }
  388. // void OnSpoolerStatus(UINT nStatus, UINT nJobs)
  389. #define MSG_WM_SPOOLERSTATUS(func) \
  390. if (uMsg == WM_SPOOLERSTATUS) \
  391. { \
  392. this->SetMsgHandled(TRUE); \
  393. func((UINT)wParam, (UINT)LOWORD(lParam)); \
  394. lResult = 0; \
  395. if(this->IsMsgHandled()) \
  396. return TRUE; \
  397. }
  398. // void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  399. #define MSG_WM_DRAWITEM(func) \
  400. if (uMsg == WM_DRAWITEM) \
  401. { \
  402. this->SetMsgHandled(TRUE); \
  403. func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
  404. lResult = TRUE; \
  405. if(this->IsMsgHandled()) \
  406. return TRUE; \
  407. }
  408. // void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
  409. #define MSG_WM_MEASUREITEM(func) \
  410. if (uMsg == WM_MEASUREITEM) \
  411. { \
  412. this->SetMsgHandled(TRUE); \
  413. func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
  414. lResult = TRUE; \
  415. if(this->IsMsgHandled()) \
  416. return TRUE; \
  417. }
  418. // void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
  419. #define MSG_WM_DELETEITEM(func) \
  420. if (uMsg == WM_DELETEITEM) \
  421. { \
  422. this->SetMsgHandled(TRUE); \
  423. func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
  424. lResult = TRUE; \
  425. if(this->IsMsgHandled()) \
  426. return TRUE; \
  427. }
  428. //int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
  429. #define MSG_WM_CHARTOITEM(func) \
  430. if (uMsg == WM_CHARTOITEM) \
  431. { \
  432. this->SetMsgHandled(TRUE); \
  433. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  434. if(this->IsMsgHandled()) \
  435. return TRUE; \
  436. }
  437. // int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
  438. #define MSG_WM_VKEYTOITEM(func) \
  439. if (uMsg == WM_VKEYTOITEM) \
  440. { \
  441. this->SetMsgHandled(TRUE); \
  442. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  443. if(this->IsMsgHandled()) \
  444. return TRUE; \
  445. }
  446. // HCURSOR OnQueryDragIcon()
  447. #define MSG_WM_QUERYDRAGICON(func) \
  448. if (uMsg == WM_QUERYDRAGICON) \
  449. { \
  450. this->SetMsgHandled(TRUE); \
  451. lResult = (LRESULT)func(); \
  452. if(this->IsMsgHandled()) \
  453. return TRUE; \
  454. }
  455. // int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
  456. #define MSG_WM_COMPAREITEM(func) \
  457. if (uMsg == WM_COMPAREITEM) \
  458. { \
  459. this->SetMsgHandled(TRUE); \
  460. lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
  461. if(this->IsMsgHandled()) \
  462. return TRUE; \
  463. }
  464. // void OnCompacting(UINT nCpuTime)
  465. #define MSG_WM_COMPACTING(func) \
  466. if (uMsg == WM_COMPACTING) \
  467. { \
  468. this->SetMsgHandled(TRUE); \
  469. func((UINT)wParam); \
  470. lResult = 0; \
  471. if(this->IsMsgHandled()) \
  472. return TRUE; \
  473. }
  474. // BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct)
  475. #define MSG_WM_NCCREATE(func) \
  476. if (uMsg == WM_NCCREATE) \
  477. { \
  478. this->SetMsgHandled(TRUE); \
  479. lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
  480. if(this->IsMsgHandled()) \
  481. return TRUE; \
  482. }
  483. // void OnNcDestroy()
  484. #define MSG_WM_NCDESTROY(func) \
  485. if (uMsg == WM_NCDESTROY) \
  486. { \
  487. this->SetMsgHandled(TRUE); \
  488. func(); \
  489. lResult = 0; \
  490. if(this->IsMsgHandled()) \
  491. return TRUE; \
  492. }
  493. // LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam)
  494. #define MSG_WM_NCCALCSIZE(func) \
  495. if (uMsg == WM_NCCALCSIZE) \
  496. { \
  497. this->SetMsgHandled(TRUE); \
  498. lResult = func((BOOL)wParam, lParam); \
  499. if(this->IsMsgHandled()) \
  500. return TRUE; \
  501. }
  502. // UINT OnNcHitTest(CPoint point)
  503. #define MSG_WM_NCHITTEST(func) \
  504. if (uMsg == WM_NCHITTEST) \
  505. { \
  506. this->SetMsgHandled(TRUE); \
  507. lResult = (LRESULT)func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  508. if(this->IsMsgHandled()) \
  509. return TRUE; \
  510. }
  511. // void OnNcPaint(CRgnHandle rgn)
  512. #define MSG_WM_NCPAINT(func) \
  513. if (uMsg == WM_NCPAINT) \
  514. { \
  515. this->SetMsgHandled(TRUE); \
  516. func((HRGN)wParam); \
  517. lResult = 0; \
  518. if(this->IsMsgHandled()) \
  519. return TRUE; \
  520. }
  521. // BOOL OnNcActivate(BOOL bActive)
  522. #define MSG_WM_NCACTIVATE(func) \
  523. if (uMsg == WM_NCACTIVATE) \
  524. { \
  525. this->SetMsgHandled(TRUE); \
  526. lResult = (LRESULT)func((BOOL)wParam); \
  527. if(this->IsMsgHandled()) \
  528. return TRUE; \
  529. }
  530. // UINT OnGetDlgCode(LPMSG lpMsg)
  531. #define MSG_WM_GETDLGCODE(func) \
  532. if (uMsg == WM_GETDLGCODE) \
  533. { \
  534. this->SetMsgHandled(TRUE); \
  535. lResult = (LRESULT)func((LPMSG)lParam); \
  536. if(this->IsMsgHandled()) \
  537. return TRUE; \
  538. }
  539. // void OnNcMouseMove(UINT nHitTest, CPoint point)
  540. #define MSG_WM_NCMOUSEMOVE(func) \
  541. if (uMsg == WM_NCMOUSEMOVE) \
  542. { \
  543. this->SetMsgHandled(TRUE); \
  544. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  545. lResult = 0; \
  546. if(this->IsMsgHandled()) \
  547. return TRUE; \
  548. }
  549. // void OnNcLButtonDown(UINT nHitTest, CPoint point)
  550. #define MSG_WM_NCLBUTTONDOWN(func) \
  551. if (uMsg == WM_NCLBUTTONDOWN) \
  552. { \
  553. this->SetMsgHandled(TRUE); \
  554. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  555. lResult = 0; \
  556. if(this->IsMsgHandled()) \
  557. return TRUE; \
  558. }
  559. // void OnNcLButtonUp(UINT nHitTest, CPoint point)
  560. #define MSG_WM_NCLBUTTONUP(func) \
  561. if (uMsg == WM_NCLBUTTONUP) \
  562. { \
  563. this->SetMsgHandled(TRUE); \
  564. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  565. lResult = 0; \
  566. if(this->IsMsgHandled()) \
  567. return TRUE; \
  568. }
  569. // void OnNcLButtonDblClk(UINT nHitTest, CPoint point)
  570. #define MSG_WM_NCLBUTTONDBLCLK(func) \
  571. if (uMsg == WM_NCLBUTTONDBLCLK) \
  572. { \
  573. this->SetMsgHandled(TRUE); \
  574. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  575. lResult = 0; \
  576. if(this->IsMsgHandled()) \
  577. return TRUE; \
  578. }
  579. // void OnNcRButtonDown(UINT nHitTest, CPoint point)
  580. #define MSG_WM_NCRBUTTONDOWN(func) \
  581. if (uMsg == WM_NCRBUTTONDOWN) \
  582. { \
  583. this->SetMsgHandled(TRUE); \
  584. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  585. lResult = 0; \
  586. if(this->IsMsgHandled()) \
  587. return TRUE; \
  588. }
  589. // void OnNcRButtonUp(UINT nHitTest, CPoint point)
  590. #define MSG_WM_NCRBUTTONUP(func) \
  591. if (uMsg == WM_NCRBUTTONUP) \
  592. { \
  593. this->SetMsgHandled(TRUE); \
  594. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  595. lResult = 0; \
  596. if(this->IsMsgHandled()) \
  597. return TRUE; \
  598. }
  599. // void OnNcRButtonDblClk(UINT nHitTest, CPoint point)
  600. #define MSG_WM_NCRBUTTONDBLCLK(func) \
  601. if (uMsg == WM_NCRBUTTONDBLCLK) \
  602. { \
  603. this->SetMsgHandled(TRUE); \
  604. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  605. lResult = 0; \
  606. if(this->IsMsgHandled()) \
  607. return TRUE; \
  608. }
  609. // void OnNcMButtonDown(UINT nHitTest, CPoint point)
  610. #define MSG_WM_NCMBUTTONDOWN(func) \
  611. if (uMsg == WM_NCMBUTTONDOWN) \
  612. { \
  613. this->SetMsgHandled(TRUE); \
  614. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  615. lResult = 0; \
  616. if(this->IsMsgHandled()) \
  617. return TRUE; \
  618. }
  619. // void OnNcMButtonUp(UINT nHitTest, CPoint point)
  620. #define MSG_WM_NCMBUTTONUP(func) \
  621. if (uMsg == WM_NCMBUTTONUP) \
  622. { \
  623. this->SetMsgHandled(TRUE); \
  624. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  625. lResult = 0; \
  626. if(this->IsMsgHandled()) \
  627. return TRUE; \
  628. }
  629. // void OnNcMButtonDblClk(UINT nHitTest, CPoint point)
  630. #define MSG_WM_NCMBUTTONDBLCLK(func) \
  631. if (uMsg == WM_NCMBUTTONDBLCLK) \
  632. { \
  633. this->SetMsgHandled(TRUE); \
  634. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  635. lResult = 0; \
  636. if(this->IsMsgHandled()) \
  637. return TRUE; \
  638. }
  639. // void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  640. #define MSG_WM_KEYDOWN(func) \
  641. if (uMsg == WM_KEYDOWN) \
  642. { \
  643. this->SetMsgHandled(TRUE); \
  644. func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  645. lResult = 0; \
  646. if(this->IsMsgHandled()) \
  647. return TRUE; \
  648. }
  649. // void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
  650. #define MSG_WM_KEYUP(func) \
  651. if (uMsg == WM_KEYUP) \
  652. { \
  653. this->SetMsgHandled(TRUE); \
  654. func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  655. lResult = 0; \
  656. if(this->IsMsgHandled()) \
  657. return TRUE; \
  658. }
  659. // void OnChar(TCHAR chChar, UINT nRepCnt, UINT nFlags)
  660. #define MSG_WM_CHAR(func) \
  661. if (uMsg == WM_CHAR) \
  662. { \
  663. this->SetMsgHandled(TRUE); \
  664. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  665. lResult = 0; \
  666. if(this->IsMsgHandled()) \
  667. return TRUE; \
  668. }
  669. // void OnDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags)
  670. #define MSG_WM_DEADCHAR(func) \
  671. if (uMsg == WM_DEADCHAR) \
  672. { \
  673. this->SetMsgHandled(TRUE); \
  674. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  675. lResult = 0; \
  676. if(this->IsMsgHandled()) \
  677. return TRUE; \
  678. }
  679. // void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  680. #define MSG_WM_SYSKEYDOWN(func) \
  681. if (uMsg == WM_SYSKEYDOWN) \
  682. { \
  683. this->SetMsgHandled(TRUE); \
  684. func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  685. lResult = 0; \
  686. if(this->IsMsgHandled()) \
  687. return TRUE; \
  688. }
  689. // void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
  690. #define MSG_WM_SYSKEYUP(func) \
  691. if (uMsg == WM_SYSKEYUP) \
  692. { \
  693. this->SetMsgHandled(TRUE); \
  694. func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  695. lResult = 0; \
  696. if(this->IsMsgHandled()) \
  697. return TRUE; \
  698. }
  699. // void OnSysChar(TCHAR chChar, UINT nRepCnt, UINT nFlags)
  700. #define MSG_WM_SYSCHAR(func) \
  701. if (uMsg == WM_SYSCHAR) \
  702. { \
  703. this->SetMsgHandled(TRUE); \
  704. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  705. lResult = 0; \
  706. if(this->IsMsgHandled()) \
  707. return TRUE; \
  708. }
  709. // void OnSysDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags)
  710. #define MSG_WM_SYSDEADCHAR(func) \
  711. if (uMsg == WM_SYSDEADCHAR) \
  712. { \
  713. this->SetMsgHandled(TRUE); \
  714. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  715. lResult = 0; \
  716. if(this->IsMsgHandled()) \
  717. return TRUE; \
  718. }
  719. // void OnSysCommand(UINT nID, CPoint point)
  720. #define MSG_WM_SYSCOMMAND(func) \
  721. if (uMsg == WM_SYSCOMMAND) \
  722. { \
  723. this->SetMsgHandled(TRUE); \
  724. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  725. lResult = 0; \
  726. if(this->IsMsgHandled()) \
  727. return TRUE; \
  728. }
  729. // void OnTCard(UINT idAction, DWORD dwActionData)
  730. #define MSG_WM_TCARD(func) \
  731. if (uMsg == WM_TCARD) \
  732. { \
  733. this->SetMsgHandled(TRUE); \
  734. func((UINT)wParam, (DWORD)lParam); \
  735. lResult = 0; \
  736. if(this->IsMsgHandled()) \
  737. return TRUE; \
  738. }
  739. // void OnTimer(UINT_PTR nIDEvent)
  740. #define MSG_WM_TIMER(func) \
  741. if (uMsg == WM_TIMER) \
  742. { \
  743. this->SetMsgHandled(TRUE); \
  744. func((UINT_PTR)wParam); \
  745. lResult = 0; \
  746. if(this->IsMsgHandled()) \
  747. return TRUE; \
  748. }
  749. // void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  750. #define MSG_WM_HSCROLL(func) \
  751. if (uMsg == WM_HSCROLL) \
  752. { \
  753. this->SetMsgHandled(TRUE); \
  754. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  755. lResult = 0; \
  756. if(this->IsMsgHandled()) \
  757. return TRUE; \
  758. }
  759. // void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  760. #define MSG_WM_VSCROLL(func) \
  761. if (uMsg == WM_VSCROLL) \
  762. { \
  763. this->SetMsgHandled(TRUE); \
  764. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  765. lResult = 0; \
  766. if(this->IsMsgHandled()) \
  767. return TRUE; \
  768. }
  769. // void OnInitMenu(CMenuHandle menu)
  770. #define MSG_WM_INITMENU(func) \
  771. if (uMsg == WM_INITMENU) \
  772. { \
  773. this->SetMsgHandled(TRUE); \
  774. func((HMENU)wParam); \
  775. lResult = 0; \
  776. if(this->IsMsgHandled()) \
  777. return TRUE; \
  778. }
  779. // void OnInitMenuPopup(CMenuHandle menuPopup, UINT nIndex, BOOL bSysMenu)
  780. #define MSG_WM_INITMENUPOPUP(func) \
  781. if (uMsg == WM_INITMENUPOPUP) \
  782. { \
  783. this->SetMsgHandled(TRUE); \
  784. func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \
  785. lResult = 0; \
  786. if(this->IsMsgHandled()) \
  787. return TRUE; \
  788. }
  789. // void OnMenuSelect(UINT nItemID, UINT nFlags, CMenuHandle menu)
  790. #define MSG_WM_MENUSELECT(func) \
  791. if (uMsg == WM_MENUSELECT) \
  792. { \
  793. this->SetMsgHandled(TRUE); \
  794. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
  795. lResult = 0; \
  796. if(this->IsMsgHandled()) \
  797. return TRUE; \
  798. }
  799. // LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenuHandle menu)
  800. #define MSG_WM_MENUCHAR(func) \
  801. if (uMsg == WM_MENUCHAR) \
  802. { \
  803. this->SetMsgHandled(TRUE); \
  804. lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
  805. if(this->IsMsgHandled()) \
  806. return TRUE; \
  807. }
  808. // LRESULT OnNotify(int idCtrl, LPNMHDR pnmh)
  809. #define MSG_WM_NOTIFY(func) \
  810. if (uMsg == WM_NOTIFY) \
  811. { \
  812. this->SetMsgHandled(TRUE); \
  813. lResult = func((int)wParam, (LPNMHDR)lParam); \
  814. if(this->IsMsgHandled()) \
  815. return TRUE; \
  816. }
  817. // void OnEnterIdle(UINT nWhy, CWindow wndWho)
  818. #define MSG_WM_ENTERIDLE(func) \
  819. if (uMsg == WM_ENTERIDLE) \
  820. { \
  821. this->SetMsgHandled(TRUE); \
  822. func((UINT)wParam, (HWND)lParam); \
  823. lResult = 0; \
  824. if(this->IsMsgHandled()) \
  825. return TRUE; \
  826. }
  827. // void OnMouseMove(UINT nFlags, CPoint point)
  828. #define MSG_WM_MOUSEMOVE(func) \
  829. if (uMsg == WM_MOUSEMOVE) \
  830. { \
  831. this->SetMsgHandled(TRUE); \
  832. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  833. lResult = 0; \
  834. if(this->IsMsgHandled()) \
  835. return TRUE; \
  836. }
  837. // BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
  838. #define MSG_WM_MOUSEWHEEL(func) \
  839. if (uMsg == WM_MOUSEWHEEL) \
  840. { \
  841. this->SetMsgHandled(TRUE); \
  842. lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  843. if(this->IsMsgHandled()) \
  844. return TRUE; \
  845. }
  846. // void OnLButtonDown(UINT nFlags, CPoint point)
  847. #define MSG_WM_LBUTTONDOWN(func) \
  848. if (uMsg == WM_LBUTTONDOWN) \
  849. { \
  850. this->SetMsgHandled(TRUE); \
  851. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  852. lResult = 0; \
  853. if(this->IsMsgHandled()) \
  854. return TRUE; \
  855. }
  856. // void OnLButtonUp(UINT nFlags, CPoint point)
  857. #define MSG_WM_LBUTTONUP(func) \
  858. if (uMsg == WM_LBUTTONUP) \
  859. { \
  860. this->SetMsgHandled(TRUE); \
  861. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  862. lResult = 0; \
  863. if(this->IsMsgHandled()) \
  864. return TRUE; \
  865. }
  866. // void OnLButtonDblClk(UINT nFlags, CPoint point)
  867. #define MSG_WM_LBUTTONDBLCLK(func) \
  868. if (uMsg == WM_LBUTTONDBLCLK) \
  869. { \
  870. this->SetMsgHandled(TRUE); \
  871. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  872. lResult = 0; \
  873. if(this->IsMsgHandled()) \
  874. return TRUE; \
  875. }
  876. // void OnRButtonDown(UINT nFlags, CPoint point)
  877. #define MSG_WM_RBUTTONDOWN(func) \
  878. if (uMsg == WM_RBUTTONDOWN) \
  879. { \
  880. this->SetMsgHandled(TRUE); \
  881. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  882. lResult = 0; \
  883. if(this->IsMsgHandled()) \
  884. return TRUE; \
  885. }
  886. // void OnRButtonUp(UINT nFlags, CPoint point)
  887. #define MSG_WM_RBUTTONUP(func) \
  888. if (uMsg == WM_RBUTTONUP) \
  889. { \
  890. this->SetMsgHandled(TRUE); \
  891. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  892. lResult = 0; \
  893. if(this->IsMsgHandled()) \
  894. return TRUE; \
  895. }
  896. // void OnRButtonDblClk(UINT nFlags, CPoint point)
  897. #define MSG_WM_RBUTTONDBLCLK(func) \
  898. if (uMsg == WM_RBUTTONDBLCLK) \
  899. { \
  900. this->SetMsgHandled(TRUE); \
  901. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  902. lResult = 0; \
  903. if(this->IsMsgHandled()) \
  904. return TRUE; \
  905. }
  906. // void OnMButtonDown(UINT nFlags, CPoint point)
  907. #define MSG_WM_MBUTTONDOWN(func) \
  908. if (uMsg == WM_MBUTTONDOWN) \
  909. { \
  910. this->SetMsgHandled(TRUE); \
  911. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  912. lResult = 0; \
  913. if(this->IsMsgHandled()) \
  914. return TRUE; \
  915. }
  916. // void OnMButtonUp(UINT nFlags, CPoint point)
  917. #define MSG_WM_MBUTTONUP(func) \
  918. if (uMsg == WM_MBUTTONUP) \
  919. { \
  920. this->SetMsgHandled(TRUE); \
  921. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  922. lResult = 0; \
  923. if(this->IsMsgHandled()) \
  924. return TRUE; \
  925. }
  926. // void OnMButtonDblClk(UINT nFlags, CPoint point)
  927. #define MSG_WM_MBUTTONDBLCLK(func) \
  928. if (uMsg == WM_MBUTTONDBLCLK) \
  929. { \
  930. this->SetMsgHandled(TRUE); \
  931. func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  932. lResult = 0; \
  933. if(this->IsMsgHandled()) \
  934. return TRUE; \
  935. }
  936. // void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam)
  937. #define MSG_WM_PARENTNOTIFY(func) \
  938. if (uMsg == WM_PARENTNOTIFY) \
  939. { \
  940. this->SetMsgHandled(TRUE); \
  941. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
  942. lResult = 0; \
  943. if(this->IsMsgHandled()) \
  944. return TRUE; \
  945. }
  946. // void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate)
  947. #define MSG_WM_MDIACTIVATE(func) \
  948. if (uMsg == WM_MDIACTIVATE) \
  949. { \
  950. this->SetMsgHandled(TRUE); \
  951. func((HWND)wParam, (HWND)lParam); \
  952. lResult = 0; \
  953. if(this->IsMsgHandled()) \
  954. return TRUE; \
  955. }
  956. // void OnRenderFormat(UINT nFormat)
  957. #define MSG_WM_RENDERFORMAT(func) \
  958. if (uMsg == WM_RENDERFORMAT) \
  959. { \
  960. this->SetMsgHandled(TRUE); \
  961. func((UINT)wParam); \
  962. lResult = 0; \
  963. if(this->IsMsgHandled()) \
  964. return TRUE; \
  965. }
  966. // void OnRenderAllFormats()
  967. #define MSG_WM_RENDERALLFORMATS(func) \
  968. if (uMsg == WM_RENDERALLFORMATS) \
  969. { \
  970. this->SetMsgHandled(TRUE); \
  971. func(); \
  972. lResult = 0; \
  973. if(this->IsMsgHandled()) \
  974. return TRUE; \
  975. }
  976. // void OnDestroyClipboard()
  977. #define MSG_WM_DESTROYCLIPBOARD(func) \
  978. if (uMsg == WM_DESTROYCLIPBOARD) \
  979. { \
  980. this->SetMsgHandled(TRUE); \
  981. func(); \
  982. lResult = 0; \
  983. if(this->IsMsgHandled()) \
  984. return TRUE; \
  985. }
  986. // void OnDrawClipboard()
  987. #define MSG_WM_DRAWCLIPBOARD(func) \
  988. if (uMsg == WM_DRAWCLIPBOARD) \
  989. { \
  990. this->SetMsgHandled(TRUE); \
  991. func(); \
  992. lResult = 0; \
  993. if(this->IsMsgHandled()) \
  994. return TRUE; \
  995. }
  996. // void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct)
  997. #define MSG_WM_PAINTCLIPBOARD(func) \
  998. if (uMsg == WM_PAINTCLIPBOARD) \
  999. { \
  1000. this->SetMsgHandled(TRUE); \
  1001. func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \
  1002. ::GlobalUnlock((HGLOBAL)lParam); \
  1003. lResult = 0; \
  1004. if(this->IsMsgHandled()) \
  1005. return TRUE; \
  1006. }
  1007. // void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
  1008. #define MSG_WM_VSCROLLCLIPBOARD(func) \
  1009. if (uMsg == WM_VSCROLLCLIPBOARD) \
  1010. { \
  1011. this->SetMsgHandled(TRUE); \
  1012. func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
  1013. lResult = 0; \
  1014. if(this->IsMsgHandled()) \
  1015. return TRUE; \
  1016. }
  1017. // void OnContextMenu(CWindow wnd, CPoint point)
  1018. #define MSG_WM_CONTEXTMENU(func) \
  1019. if (uMsg == WM_CONTEXTMENU) \
  1020. { \
  1021. this->SetMsgHandled(TRUE); \
  1022. func((HWND)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1023. lResult = 0; \
  1024. if(this->IsMsgHandled()) \
  1025. return TRUE; \
  1026. }
  1027. // void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect)
  1028. #define MSG_WM_SIZECLIPBOARD(func) \
  1029. if (uMsg == WM_SIZECLIPBOARD) \
  1030. { \
  1031. this->SetMsgHandled(TRUE); \
  1032. func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \
  1033. ::GlobalUnlock((HGLOBAL)lParam); \
  1034. lResult = 0; \
  1035. if(this->IsMsgHandled()) \
  1036. return TRUE; \
  1037. }
  1038. // void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString)
  1039. #define MSG_WM_ASKCBFORMATNAME(func) \
  1040. if (uMsg == WM_ASKCBFORMATNAME) \
  1041. { \
  1042. this->SetMsgHandled(TRUE); \
  1043. func((UINT)wParam, (LPTSTR)lParam); \
  1044. lResult = 0; \
  1045. if(this->IsMsgHandled()) \
  1046. return TRUE; \
  1047. }
  1048. // void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter)
  1049. #define MSG_WM_CHANGECBCHAIN(func) \
  1050. if (uMsg == WM_CHANGECBCHAIN) \
  1051. { \
  1052. this->SetMsgHandled(TRUE); \
  1053. func((HWND)wParam, (HWND)lParam); \
  1054. lResult = 0; \
  1055. if(this->IsMsgHandled()) \
  1056. return TRUE; \
  1057. }
  1058. // void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
  1059. #define MSG_WM_HSCROLLCLIPBOARD(func) \
  1060. if (uMsg == WM_HSCROLLCLIPBOARD) \
  1061. { \
  1062. this->SetMsgHandled(TRUE); \
  1063. func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
  1064. lResult = 0; \
  1065. if(this->IsMsgHandled()) \
  1066. return TRUE; \
  1067. }
  1068. // BOOL OnQueryNewPalette()
  1069. #define MSG_WM_QUERYNEWPALETTE(func) \
  1070. if (uMsg == WM_QUERYNEWPALETTE) \
  1071. { \
  1072. this->SetMsgHandled(TRUE); \
  1073. lResult = (LRESULT)func(); \
  1074. if(this->IsMsgHandled()) \
  1075. return TRUE; \
  1076. }
  1077. // void OnPaletteChanged(CWindow wndFocus)
  1078. #define MSG_WM_PALETTECHANGED(func) \
  1079. if (uMsg == WM_PALETTECHANGED) \
  1080. { \
  1081. this->SetMsgHandled(TRUE); \
  1082. func((HWND)wParam); \
  1083. lResult = 0; \
  1084. if(this->IsMsgHandled()) \
  1085. return TRUE; \
  1086. }
  1087. // void OnPaletteIsChanging(CWindow wndPalChg)
  1088. #define MSG_WM_PALETTEISCHANGING(func) \
  1089. if (uMsg == WM_PALETTEISCHANGING) \
  1090. { \
  1091. this->SetMsgHandled(TRUE); \
  1092. func((HWND)wParam); \
  1093. lResult = 0; \
  1094. if(this->IsMsgHandled()) \
  1095. return TRUE; \
  1096. }
  1097. // void OnDropFiles(HDROP hDropInfo)
  1098. #define MSG_WM_DROPFILES(func) \
  1099. if (uMsg == WM_DROPFILES) \
  1100. { \
  1101. this->SetMsgHandled(TRUE); \
  1102. func((HDROP)wParam); \
  1103. lResult = 0; \
  1104. if(this->IsMsgHandled()) \
  1105. return TRUE; \
  1106. }
  1107. // void OnWindowPosChanging(LPWINDOWPOS lpWndPos)
  1108. #define MSG_WM_WINDOWPOSCHANGING(func) \
  1109. if (uMsg == WM_WINDOWPOSCHANGING) \
  1110. { \
  1111. this->SetMsgHandled(TRUE); \
  1112. func((LPWINDOWPOS)lParam); \
  1113. lResult = 0; \
  1114. if(this->IsMsgHandled()) \
  1115. return TRUE; \
  1116. }
  1117. // void OnWindowPosChanged(LPWINDOWPOS lpWndPos)
  1118. #define MSG_WM_WINDOWPOSCHANGED(func) \
  1119. if (uMsg == WM_WINDOWPOSCHANGED) \
  1120. { \
  1121. this->SetMsgHandled(TRUE); \
  1122. func((LPWINDOWPOS)lParam); \
  1123. lResult = 0; \
  1124. if(this->IsMsgHandled()) \
  1125. return TRUE; \
  1126. }
  1127. // void OnExitMenuLoop(BOOL fIsTrackPopupMenu)
  1128. #define MSG_WM_EXITMENULOOP(func) \
  1129. if (uMsg == WM_EXITMENULOOP) \
  1130. { \
  1131. this->SetMsgHandled(TRUE); \
  1132. func((BOOL)wParam); \
  1133. lResult = 0; \
  1134. if(this->IsMsgHandled()) \
  1135. return TRUE; \
  1136. }
  1137. // void OnEnterMenuLoop(BOOL fIsTrackPopupMenu)
  1138. #define MSG_WM_ENTERMENULOOP(func) \
  1139. if (uMsg == WM_ENTERMENULOOP) \
  1140. { \
  1141. this->SetMsgHandled(TRUE); \
  1142. func((BOOL)wParam); \
  1143. lResult = 0; \
  1144. if(this->IsMsgHandled()) \
  1145. return TRUE; \
  1146. }
  1147. // void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
  1148. #define MSG_WM_STYLECHANGED(func) \
  1149. if (uMsg == WM_STYLECHANGED) \
  1150. { \
  1151. this->SetMsgHandled(TRUE); \
  1152. func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
  1153. lResult = 0; \
  1154. if(this->IsMsgHandled()) \
  1155. return TRUE; \
  1156. }
  1157. // void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
  1158. #define MSG_WM_STYLECHANGING(func) \
  1159. if (uMsg == WM_STYLECHANGING) \
  1160. { \
  1161. this->SetMsgHandled(TRUE); \
  1162. func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
  1163. lResult = 0; \
  1164. if(this->IsMsgHandled()) \
  1165. return TRUE; \
  1166. }
  1167. // void OnSizing(UINT fwSide, LPRECT pRect)
  1168. #define MSG_WM_SIZING(func) \
  1169. if (uMsg == WM_SIZING) \
  1170. { \
  1171. this->SetMsgHandled(TRUE); \
  1172. func((UINT)wParam, (LPRECT)lParam); \
  1173. lResult = TRUE; \
  1174. if(this->IsMsgHandled()) \
  1175. return TRUE; \
  1176. }
  1177. // void OnMoving(UINT fwSide, LPRECT pRect)
  1178. #define MSG_WM_MOVING(func) \
  1179. if (uMsg == WM_MOVING) \
  1180. { \
  1181. this->SetMsgHandled(TRUE); \
  1182. func((UINT)wParam, (LPRECT)lParam); \
  1183. lResult = TRUE; \
  1184. if(this->IsMsgHandled()) \
  1185. return TRUE; \
  1186. }
  1187. // void OnCaptureChanged(CWindow wnd)
  1188. #define MSG_WM_CAPTURECHANGED(func) \
  1189. if (uMsg == WM_CAPTURECHANGED) \
  1190. { \
  1191. this->SetMsgHandled(TRUE); \
  1192. func((HWND)lParam); \
  1193. lResult = 0; \
  1194. if(this->IsMsgHandled()) \
  1195. return TRUE; \
  1196. }
  1197. // BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData)
  1198. #define MSG_WM_DEVICECHANGE(func) \
  1199. if (uMsg == WM_DEVICECHANGE) \
  1200. { \
  1201. this->SetMsgHandled(TRUE); \
  1202. lResult = (LRESULT)func((UINT)wParam, (DWORD_PTR)lParam); \
  1203. if(this->IsMsgHandled()) \
  1204. return TRUE; \
  1205. }
  1206. // void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
  1207. #define MSG_WM_COMMAND(func) \
  1208. if (uMsg == WM_COMMAND) \
  1209. { \
  1210. this->SetMsgHandled(TRUE); \
  1211. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  1212. lResult = 0; \
  1213. if(this->IsMsgHandled()) \
  1214. return TRUE; \
  1215. }
  1216. // void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen)
  1217. #define MSG_WM_DISPLAYCHANGE(func) \
  1218. if (uMsg == WM_DISPLAYCHANGE) \
  1219. { \
  1220. this->SetMsgHandled(TRUE); \
  1221. func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1222. lResult = 0; \
  1223. if(this->IsMsgHandled()) \
  1224. return TRUE; \
  1225. }
  1226. // void OnEnterSizeMove()
  1227. #define MSG_WM_ENTERSIZEMOVE(func) \
  1228. if (uMsg == WM_ENTERSIZEMOVE) \
  1229. { \
  1230. this->SetMsgHandled(TRUE); \
  1231. func(); \
  1232. lResult = 0; \
  1233. if(this->IsMsgHandled()) \
  1234. return TRUE; \
  1235. }
  1236. // void OnExitSizeMove()
  1237. #define MSG_WM_EXITSIZEMOVE(func) \
  1238. if (uMsg == WM_EXITSIZEMOVE) \
  1239. { \
  1240. this->SetMsgHandled(TRUE); \
  1241. func(); \
  1242. lResult = 0; \
  1243. if(this->IsMsgHandled()) \
  1244. return TRUE; \
  1245. }
  1246. // HFONT OnGetFont()
  1247. #define MSG_WM_GETFONT(func) \
  1248. if (uMsg == WM_GETFONT) \
  1249. { \
  1250. this->SetMsgHandled(TRUE); \
  1251. lResult = (LRESULT)func(); \
  1252. if(this->IsMsgHandled()) \
  1253. return TRUE; \
  1254. }
  1255. // LRESULT OnGetHotKey()
  1256. #define MSG_WM_GETHOTKEY(func) \
  1257. if (uMsg == WM_GETHOTKEY) \
  1258. { \
  1259. this->SetMsgHandled(TRUE); \
  1260. lResult = func(); \
  1261. if(this->IsMsgHandled()) \
  1262. return TRUE; \
  1263. }
  1264. // HICON OnGetIcon()
  1265. #define MSG_WM_GETICON(func) \
  1266. if (uMsg == WM_GETICON) \
  1267. { \
  1268. this->SetMsgHandled(TRUE); \
  1269. lResult = (LRESULT)func((UINT)wParam); \
  1270. if(this->IsMsgHandled()) \
  1271. return TRUE; \
  1272. }
  1273. // int OnGetText(int cchTextMax, LPTSTR lpszText)
  1274. #define MSG_WM_GETTEXT(func) \
  1275. if (uMsg == WM_GETTEXT) \
  1276. { \
  1277. this->SetMsgHandled(TRUE); \
  1278. lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \
  1279. if(this->IsMsgHandled()) \
  1280. return TRUE; \
  1281. }
  1282. // int OnGetTextLength()
  1283. #define MSG_WM_GETTEXTLENGTH(func) \
  1284. if (uMsg == WM_GETTEXTLENGTH) \
  1285. { \
  1286. this->SetMsgHandled(TRUE); \
  1287. lResult = (LRESULT)func(); \
  1288. if(this->IsMsgHandled()) \
  1289. return TRUE; \
  1290. }
  1291. // void OnHelp(LPHELPINFO lpHelpInfo)
  1292. #define MSG_WM_HELP(func) \
  1293. if (uMsg == WM_HELP) \
  1294. { \
  1295. this->SetMsgHandled(TRUE); \
  1296. func((LPHELPINFO)lParam); \
  1297. lResult = TRUE; \
  1298. if(this->IsMsgHandled()) \
  1299. return TRUE; \
  1300. }
  1301. // void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey)
  1302. #define MSG_WM_HOTKEY(func) \
  1303. if (uMsg == WM_HOTKEY) \
  1304. { \
  1305. this->SetMsgHandled(TRUE); \
  1306. func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
  1307. lResult = 0; \
  1308. if(this->IsMsgHandled()) \
  1309. return TRUE; \
  1310. }
  1311. // void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout)
  1312. #define MSG_WM_INPUTLANGCHANGE(func) \
  1313. if (uMsg == WM_INPUTLANGCHANGE) \
  1314. { \
  1315. this->SetMsgHandled(TRUE); \
  1316. func((DWORD)wParam, (HKL)lParam); \
  1317. lResult = TRUE; \
  1318. if(this->IsMsgHandled()) \
  1319. return TRUE; \
  1320. }
  1321. // void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout)
  1322. #define MSG_WM_INPUTLANGCHANGEREQUEST(func) \
  1323. if (uMsg == WM_INPUTLANGCHANGEREQUEST) \
  1324. { \
  1325. this->SetMsgHandled(TRUE); \
  1326. func((BOOL)wParam, (HKL)lParam); \
  1327. lResult = 0; \
  1328. if(this->IsMsgHandled()) \
  1329. return TRUE; \
  1330. }
  1331. // void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus)
  1332. #define MSG_WM_NEXTDLGCTL(func) \
  1333. if (uMsg == WM_NEXTDLGCTL) \
  1334. { \
  1335. this->SetMsgHandled(TRUE); \
  1336. func((BOOL)LOWORD(lParam), wParam); \
  1337. lResult = 0; \
  1338. if(this->IsMsgHandled()) \
  1339. return TRUE; \
  1340. }
  1341. // void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu)
  1342. #define MSG_WM_NEXTMENU(func) \
  1343. if (uMsg == WM_NEXTMENU) \
  1344. { \
  1345. this->SetMsgHandled(TRUE); \
  1346. func((int)wParam, (LPMDINEXTMENU)lParam); \
  1347. lResult = 0; \
  1348. if(this->IsMsgHandled()) \
  1349. return TRUE; \
  1350. }
  1351. // int OnNotifyFormat(CWindow wndFrom, int nCommand)
  1352. #define MSG_WM_NOTIFYFORMAT(func) \
  1353. if (uMsg == WM_NOTIFYFORMAT) \
  1354. { \
  1355. this->SetMsgHandled(TRUE); \
  1356. lResult = (LRESULT)func((HWND)wParam, (int)lParam); \
  1357. if(this->IsMsgHandled()) \
  1358. return TRUE; \
  1359. }
  1360. // BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD_PTR dwData)
  1361. #define MSG_WM_POWERBROADCAST(func) \
  1362. if (uMsg == WM_POWERBROADCAST) \
  1363. { \
  1364. this->SetMsgHandled(TRUE); \
  1365. lResult = (LRESULT)func((DWORD)wParam, (DWORD_PTR)lParam); \
  1366. if(this->IsMsgHandled()) \
  1367. return TRUE; \
  1368. }
  1369. // void OnPrint(CDCHandle dc, UINT uFlags)
  1370. #define MSG_WM_PRINT(func) \
  1371. if (uMsg == WM_PRINT) \
  1372. { \
  1373. this->SetMsgHandled(TRUE); \
  1374. func((HDC)wParam, (UINT)lParam); \
  1375. lResult = 0; \
  1376. if(this->IsMsgHandled()) \
  1377. return TRUE; \
  1378. }
  1379. // void OnPrintClient(CDCHandle dc, UINT uFlags)
  1380. #define MSG_WM_PRINTCLIENT(func) \
  1381. if (uMsg == WM_PRINTCLIENT) \
  1382. { \
  1383. this->SetMsgHandled(TRUE); \
  1384. func((HDC)wParam, (UINT)lParam); \
  1385. lResult = 0; \
  1386. if(this->IsMsgHandled()) \
  1387. return TRUE; \
  1388. }
  1389. // void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError)
  1390. #define MSG_WM_RASDIALEVENT(func) \
  1391. if (uMsg == WM_RASDIALEVENT) \
  1392. { \
  1393. this->SetMsgHandled(TRUE); \
  1394. func((RASCONNSTATE)wParam, (DWORD)lParam); \
  1395. lResult = TRUE; \
  1396. if(this->IsMsgHandled()) \
  1397. return TRUE; \
  1398. }
  1399. // void OnSetFont(CFontHandle font, BOOL bRedraw)
  1400. #define MSG_WM_SETFONT(func) \
  1401. if (uMsg == WM_SETFONT) \
  1402. { \
  1403. this->SetMsgHandled(TRUE); \
  1404. func((HFONT)wParam, (BOOL)LOWORD(lParam)); \
  1405. lResult = 0; \
  1406. if(this->IsMsgHandled()) \
  1407. return TRUE; \
  1408. }
  1409. // int OnSetHotKey(int nVirtKey, UINT uFlags)
  1410. #define MSG_WM_SETHOTKEY(func) \
  1411. if (uMsg == WM_SETHOTKEY) \
  1412. { \
  1413. this->SetMsgHandled(TRUE); \
  1414. lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \
  1415. if(this->IsMsgHandled()) \
  1416. return TRUE; \
  1417. }
  1418. // HICON OnSetIcon(UINT uType, HICON hIcon)
  1419. #define MSG_WM_SETICON(func) \
  1420. if (uMsg == WM_SETICON) \
  1421. { \
  1422. this->SetMsgHandled(TRUE); \
  1423. lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \
  1424. if(this->IsMsgHandled()) \
  1425. return TRUE; \
  1426. }
  1427. // void OnSetRedraw(BOOL bRedraw)
  1428. #define MSG_WM_SETREDRAW(func) \
  1429. if (uMsg == WM_SETREDRAW) \
  1430. { \
  1431. this->SetMsgHandled(TRUE); \
  1432. func((BOOL)wParam); \
  1433. lResult = 0; \
  1434. if(this->IsMsgHandled()) \
  1435. return TRUE; \
  1436. }
  1437. // int OnSetText(LPCTSTR lpstrText)
  1438. #define MSG_WM_SETTEXT(func) \
  1439. if (uMsg == WM_SETTEXT) \
  1440. { \
  1441. this->SetMsgHandled(TRUE); \
  1442. lResult = (LRESULT)func((LPCTSTR)lParam); \
  1443. if(this->IsMsgHandled()) \
  1444. return TRUE; \
  1445. }
  1446. // void OnUserChanged()
  1447. #define MSG_WM_USERCHANGED(func) \
  1448. if (uMsg == WM_USERCHANGED) \
  1449. { \
  1450. this->SetMsgHandled(TRUE); \
  1451. func(); \
  1452. lResult = 0; \
  1453. if(this->IsMsgHandled()) \
  1454. return TRUE; \
  1455. }
  1456. ///////////////////////////////////////////////////////////////////////////////
  1457. // Newer Windows messages
  1458. // void OnMouseHover(WPARAM wParam, CPoint ptPos)
  1459. #define MSG_WM_MOUSEHOVER(func) \
  1460. if (uMsg == WM_MOUSEHOVER) \
  1461. { \
  1462. this->SetMsgHandled(TRUE); \
  1463. func(wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1464. lResult = 0; \
  1465. if(this->IsMsgHandled()) \
  1466. return TRUE; \
  1467. }
  1468. // void OnMouseLeave()
  1469. #define MSG_WM_MOUSELEAVE(func) \
  1470. if (uMsg == WM_MOUSELEAVE) \
  1471. { \
  1472. this->SetMsgHandled(TRUE); \
  1473. func(); \
  1474. lResult = 0; \
  1475. if(this->IsMsgHandled()) \
  1476. return TRUE; \
  1477. }
  1478. // void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu)
  1479. #define MSG_WM_MENURBUTTONUP(func) \
  1480. if (uMsg == WM_MENURBUTTONUP) \
  1481. { \
  1482. this->SetMsgHandled(TRUE); \
  1483. func(wParam, (HMENU)lParam); \
  1484. lResult = 0; \
  1485. if(this->IsMsgHandled()) \
  1486. return TRUE; \
  1487. }
  1488. // LRESULT OnMenuDrag(WPARAM wParam, CMenuHandle menu)
  1489. #define MSG_WM_MENUDRAG(func) \
  1490. if (uMsg == WM_MENUDRAG) \
  1491. { \
  1492. this->SetMsgHandled(TRUE); \
  1493. lResult = func(wParam, (HMENU)lParam); \
  1494. if(this->IsMsgHandled()) \
  1495. return TRUE; \
  1496. }
  1497. // LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info)
  1498. #define MSG_WM_MENUGETOBJECT(func) \
  1499. if (uMsg == WM_MENUGETOBJECT) \
  1500. { \
  1501. this->SetMsgHandled(TRUE); \
  1502. lResult = func((PMENUGETOBJECTINFO)lParam); \
  1503. if(this->IsMsgHandled()) \
  1504. return TRUE; \
  1505. }
  1506. // void OnUnInitMenuPopup(UINT nID, CMenuHandle menu)
  1507. #define MSG_WM_UNINITMENUPOPUP(func) \
  1508. if (uMsg == WM_UNINITMENUPOPUP) \
  1509. { \
  1510. this->SetMsgHandled(TRUE); \
  1511. func((UINT)HIWORD(lParam), (HMENU)wParam); \
  1512. lResult = 0; \
  1513. if(this->IsMsgHandled()) \
  1514. return TRUE; \
  1515. }
  1516. // void OnMenuCommand(WPARAM nIndex, CMenuHandle menu)
  1517. #define MSG_WM_MENUCOMMAND(func) \
  1518. if (uMsg == WM_MENUCOMMAND) \
  1519. { \
  1520. this->SetMsgHandled(TRUE); \
  1521. func(wParam, (HMENU)lParam); \
  1522. lResult = 0; \
  1523. if(this->IsMsgHandled()) \
  1524. return TRUE; \
  1525. }
  1526. // BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys)
  1527. #define MSG_WM_APPCOMMAND(func) \
  1528. if (uMsg == WM_APPCOMMAND) \
  1529. { \
  1530. this->SetMsgHandled(TRUE); \
  1531. lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \
  1532. if(this->IsMsgHandled()) \
  1533. return TRUE; \
  1534. }
  1535. // void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos)
  1536. #define MSG_WM_NCXBUTTONDOWN(func) \
  1537. if (uMsg == WM_NCXBUTTONDOWN) \
  1538. { \
  1539. this->SetMsgHandled(TRUE); \
  1540. func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1541. lResult = (LRESULT)TRUE; \
  1542. if(this->IsMsgHandled()) \
  1543. return TRUE; \
  1544. }
  1545. // void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos)
  1546. #define MSG_WM_NCXBUTTONUP(func) \
  1547. if (uMsg == WM_NCXBUTTONUP) \
  1548. { \
  1549. this->SetMsgHandled(TRUE); \
  1550. func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1551. lResult = (LRESULT)TRUE; \
  1552. if(this->IsMsgHandled()) \
  1553. return TRUE; \
  1554. }
  1555. // void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos)
  1556. #define MSG_WM_NCXBUTTONDBLCLK(func) \
  1557. if (uMsg == WM_NCXBUTTONDBLCLK) \
  1558. { \
  1559. this->SetMsgHandled(TRUE); \
  1560. func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1561. lResult = (LRESULT)TRUE; \
  1562. if(this->IsMsgHandled()) \
  1563. return TRUE; \
  1564. }
  1565. // void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
  1566. #define MSG_WM_XBUTTONDOWN(func) \
  1567. if (uMsg == WM_XBUTTONDOWN) \
  1568. { \
  1569. this->SetMsgHandled(TRUE); \
  1570. func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1571. lResult = (LRESULT)TRUE; \
  1572. if(this->IsMsgHandled()) \
  1573. return TRUE; \
  1574. }
  1575. // void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos)
  1576. #define MSG_WM_XBUTTONUP(func) \
  1577. if (uMsg == WM_XBUTTONUP) \
  1578. { \
  1579. this->SetMsgHandled(TRUE); \
  1580. func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1581. lResult = (LRESULT)TRUE; \
  1582. if(this->IsMsgHandled()) \
  1583. return TRUE; \
  1584. }
  1585. // void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos)
  1586. #define MSG_WM_XBUTTONDBLCLK(func) \
  1587. if (uMsg == WM_XBUTTONDBLCLK) \
  1588. { \
  1589. this->SetMsgHandled(TRUE); \
  1590. func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1591. lResult = (LRESULT)TRUE; \
  1592. if(this->IsMsgHandled()) \
  1593. return TRUE; \
  1594. }
  1595. // void OnChangeUIState(WORD nAction, WORD nState)
  1596. #define MSG_WM_CHANGEUISTATE(func) \
  1597. if (uMsg == WM_CHANGEUISTATE) \
  1598. { \
  1599. this->SetMsgHandled(TRUE); \
  1600. func(LOWORD(wParam), HIWORD(wParam)); \
  1601. lResult = 0; \
  1602. if(this->IsMsgHandled()) \
  1603. return TRUE; \
  1604. }
  1605. // void OnUpdateUIState(WORD nAction, WORD nState)
  1606. #define MSG_WM_UPDATEUISTATE(func) \
  1607. if (uMsg == WM_UPDATEUISTATE) \
  1608. { \
  1609. this->SetMsgHandled(TRUE); \
  1610. func(LOWORD(wParam), HIWORD(wParam)); \
  1611. lResult = 0; \
  1612. if(this->IsMsgHandled()) \
  1613. return TRUE; \
  1614. }
  1615. // LRESULT OnQueryUIState()
  1616. #define MSG_WM_QUERYUISTATE(func) \
  1617. if (uMsg == WM_QUERYUISTATE) \
  1618. { \
  1619. this->SetMsgHandled(TRUE); \
  1620. lResult = func(); \
  1621. if(this->IsMsgHandled()) \
  1622. return TRUE; \
  1623. }
  1624. // void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput)
  1625. #define MSG_WM_INPUT(func) \
  1626. if (uMsg == WM_INPUT) \
  1627. { \
  1628. this->SetMsgHandled(TRUE); \
  1629. func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \
  1630. lResult = 0; \
  1631. if(this->IsMsgHandled()) \
  1632. return TRUE; \
  1633. }
  1634. // void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags)
  1635. #define MSG_WM_UNICHAR(func) \
  1636. if (uMsg == WM_UNICHAR) \
  1637. { \
  1638. this->SetMsgHandled(TRUE); \
  1639. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  1640. if(this->IsMsgHandled()) \
  1641. { \
  1642. lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \
  1643. return TRUE; \
  1644. } \
  1645. }
  1646. // void OnWTSSessionChange(WPARAM nStatusCode, DWORD dwSessionID)
  1647. #define MSG_WM_WTSSESSION_CHANGE(func) \
  1648. if (uMsg == WM_WTSSESSION_CHANGE) \
  1649. { \
  1650. this->SetMsgHandled(TRUE); \
  1651. func(wParam, (DWORD)lParam); \
  1652. lResult = 0; \
  1653. if(this->IsMsgHandled()) \
  1654. return TRUE; \
  1655. }
  1656. // void OnThemeChanged()
  1657. #define MSG_WM_THEMECHANGED(func) \
  1658. if (uMsg == WM_THEMECHANGED) \
  1659. { \
  1660. this->SetMsgHandled(TRUE); \
  1661. func(); \
  1662. lResult = 0; \
  1663. if(this->IsMsgHandled()) \
  1664. return TRUE; \
  1665. }
  1666. #if (_WIN32_WINNT >= 0x0600)
  1667. // BOOL OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt)
  1668. #define MSG_WM_MOUSEHWHEEL(func) \
  1669. if (uMsg == WM_MOUSEHWHEEL) \
  1670. { \
  1671. this->SetMsgHandled(TRUE); \
  1672. lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1673. if(this->IsMsgHandled()) \
  1674. return TRUE; \
  1675. }
  1676. #endif // (_WIN32_WINNT >= 0x0600)
  1677. #if (WINVER >= 0x0601)
  1678. // void OnGesture(ULONGLONG ullArguments, HGESTUREINFO hGestureInfo)
  1679. #define MSG_WM_GESTURE(func) \
  1680. if (uMsg == WM_GESTURE) \
  1681. { \
  1682. this->SetMsgHandled(TRUE); \
  1683. func((ULONGLONG)wParam, (HGESTUREINFO)lParam); \
  1684. lResult = 0; \
  1685. if(this->IsMsgHandled()) \
  1686. return TRUE; \
  1687. }
  1688. // void OnGestureNotify(PGESTURENOTIFYSTRUCT pGestureNotifyStruct)
  1689. #define MSG_WM_GESTURENOTIFY(func) \
  1690. if (uMsg == WM_GESTURENOTIFY) \
  1691. { \
  1692. func((PGESTURENOTIFYSTRUCT)lParam); \
  1693. }
  1694. // void OnDpiChanged(UINT nDpiX, UINT nDpiY, PRECT pRect)
  1695. #define MSG_WM_DPICHANGED(func) \
  1696. if (uMsg == WM_DPICHANGED) \
  1697. { \
  1698. this->SetMsgHandled(TRUE); \
  1699. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (PRECT)lParam); \
  1700. lResult = 0; \
  1701. if(this->IsMsgHandled()) \
  1702. return TRUE; \
  1703. }
  1704. #endif // (WINVER >= 0x0601)
  1705. ///////////////////////////////////////////////////////////////////////////////
  1706. // ATL defined messages
  1707. // BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData)
  1708. #define MSG_WM_FORWARDMSG(func) \
  1709. if (uMsg == WM_FORWARDMSG) \
  1710. { \
  1711. this->SetMsgHandled(TRUE); \
  1712. lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \
  1713. if(this->IsMsgHandled()) \
  1714. return TRUE; \
  1715. }
  1716. ///////////////////////////////////////////////////////////////////////////////
  1717. // Dialog specific messages
  1718. // LRESULT OnDMGetDefID()
  1719. #define MSG_DM_GETDEFID(func) \
  1720. if (uMsg == DM_GETDEFID) \
  1721. { \
  1722. this->SetMsgHandled(TRUE); \
  1723. lResult = func(); \
  1724. if(this->IsMsgHandled()) \
  1725. return TRUE; \
  1726. }
  1727. // void OnDMSetDefID(UINT DefID)
  1728. #define MSG_DM_SETDEFID(func) \
  1729. if (uMsg == DM_SETDEFID) \
  1730. { \
  1731. this->SetMsgHandled(TRUE); \
  1732. func((UINT)wParam); \
  1733. lResult = TRUE; \
  1734. if(this->IsMsgHandled()) \
  1735. return TRUE; \
  1736. }
  1737. // void OnDMReposition()
  1738. #define MSG_DM_REPOSITION(func) \
  1739. if (uMsg == DM_REPOSITION) \
  1740. { \
  1741. this->SetMsgHandled(TRUE); \
  1742. func(); \
  1743. lResult = 0; \
  1744. if(this->IsMsgHandled()) \
  1745. return TRUE; \
  1746. }
  1747. ///////////////////////////////////////////////////////////////////////////////
  1748. // Reflected messages
  1749. // void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
  1750. #define MSG_OCM_COMMAND(func) \
  1751. if (uMsg == OCM_COMMAND) \
  1752. { \
  1753. this->SetMsgHandled(TRUE); \
  1754. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  1755. lResult = 0; \
  1756. if(this->IsMsgHandled()) \
  1757. return TRUE; \
  1758. }
  1759. // LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh)
  1760. #define MSG_OCM_NOTIFY(func) \
  1761. if (uMsg == OCM_NOTIFY) \
  1762. { \
  1763. this->SetMsgHandled(TRUE); \
  1764. lResult = func((int)wParam, (LPNMHDR)lParam); \
  1765. if(this->IsMsgHandled()) \
  1766. return TRUE; \
  1767. }
  1768. // void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam)
  1769. #define MSG_OCM_PARENTNOTIFY(func) \
  1770. if (uMsg == OCM_PARENTNOTIFY) \
  1771. { \
  1772. this->SetMsgHandled(TRUE); \
  1773. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
  1774. lResult = 0; \
  1775. if(this->IsMsgHandled()) \
  1776. return TRUE; \
  1777. }
  1778. // void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  1779. #define MSG_OCM_DRAWITEM(func) \
  1780. if (uMsg == OCM_DRAWITEM) \
  1781. { \
  1782. this->SetMsgHandled(TRUE); \
  1783. func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
  1784. lResult = TRUE; \
  1785. if(this->IsMsgHandled()) \
  1786. return TRUE; \
  1787. }
  1788. // void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
  1789. #define MSG_OCM_MEASUREITEM(func) \
  1790. if (uMsg == OCM_MEASUREITEM) \
  1791. { \
  1792. this->SetMsgHandled(TRUE); \
  1793. func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
  1794. lResult = TRUE; \
  1795. if(this->IsMsgHandled()) \
  1796. return TRUE; \
  1797. }
  1798. // int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
  1799. #define MSG_OCM_COMPAREITEM(func) \
  1800. if (uMsg == OCM_COMPAREITEM) \
  1801. { \
  1802. this->SetMsgHandled(TRUE); \
  1803. lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
  1804. if(this->IsMsgHandled()) \
  1805. return TRUE; \
  1806. }
  1807. // void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
  1808. #define MSG_OCM_DELETEITEM(func) \
  1809. if (uMsg == OCM_DELETEITEM) \
  1810. { \
  1811. this->SetMsgHandled(TRUE); \
  1812. func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
  1813. lResult = TRUE; \
  1814. if(this->IsMsgHandled()) \
  1815. return TRUE; \
  1816. }
  1817. // int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
  1818. #define MSG_OCM_VKEYTOITEM(func) \
  1819. if (uMsg == OCM_VKEYTOITEM) \
  1820. { \
  1821. this->SetMsgHandled(TRUE); \
  1822. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  1823. if(this->IsMsgHandled()) \
  1824. return TRUE; \
  1825. }
  1826. //int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
  1827. #define MSG_OCM_CHARTOITEM(func) \
  1828. if (uMsg == OCM_CHARTOITEM) \
  1829. { \
  1830. this->SetMsgHandled(TRUE); \
  1831. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  1832. if(this->IsMsgHandled()) \
  1833. return TRUE; \
  1834. }
  1835. // void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  1836. #define MSG_OCM_HSCROLL(func) \
  1837. if (uMsg == OCM_HSCROLL) \
  1838. { \
  1839. this->SetMsgHandled(TRUE); \
  1840. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  1841. lResult = 0; \
  1842. if(this->IsMsgHandled()) \
  1843. return TRUE; \
  1844. }
  1845. // void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  1846. #define MSG_OCM_VSCROLL(func) \
  1847. if (uMsg == OCM_VSCROLL) \
  1848. { \
  1849. this->SetMsgHandled(TRUE); \
  1850. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  1851. lResult = 0; \
  1852. if(this->IsMsgHandled()) \
  1853. return TRUE; \
  1854. }
  1855. // HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit)
  1856. #define MSG_OCM_CTLCOLOREDIT(func) \
  1857. if (uMsg == OCM_CTLCOLOREDIT) \
  1858. { \
  1859. this->SetMsgHandled(TRUE); \
  1860. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1861. if(this->IsMsgHandled()) \
  1862. return TRUE; \
  1863. }
  1864. // HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox)
  1865. #define MSG_OCM_CTLCOLORLISTBOX(func) \
  1866. if (uMsg == OCM_CTLCOLORLISTBOX) \
  1867. { \
  1868. this->SetMsgHandled(TRUE); \
  1869. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1870. if(this->IsMsgHandled()) \
  1871. return TRUE; \
  1872. }
  1873. // HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button)
  1874. #define MSG_OCM_CTLCOLORBTN(func) \
  1875. if (uMsg == OCM_CTLCOLORBTN) \
  1876. { \
  1877. this->SetMsgHandled(TRUE); \
  1878. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1879. if(this->IsMsgHandled()) \
  1880. return TRUE; \
  1881. }
  1882. // HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd)
  1883. #define MSG_OCM_CTLCOLORDLG(func) \
  1884. if (uMsg == OCM_CTLCOLORDLG) \
  1885. { \
  1886. this->SetMsgHandled(TRUE); \
  1887. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1888. if(this->IsMsgHandled()) \
  1889. return TRUE; \
  1890. }
  1891. // HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
  1892. #define MSG_OCM_CTLCOLORSCROLLBAR(func) \
  1893. if (uMsg == OCM_CTLCOLORSCROLLBAR) \
  1894. { \
  1895. this->SetMsgHandled(TRUE); \
  1896. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1897. if(this->IsMsgHandled()) \
  1898. return TRUE; \
  1899. }
  1900. // HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic)
  1901. #define MSG_OCM_CTLCOLORSTATIC(func) \
  1902. if (uMsg == OCM_CTLCOLORSTATIC) \
  1903. { \
  1904. this->SetMsgHandled(TRUE); \
  1905. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1906. if(this->IsMsgHandled()) \
  1907. return TRUE; \
  1908. }
  1909. ///////////////////////////////////////////////////////////////////////////////
  1910. // Edit specific messages
  1911. // void OnClear()
  1912. #define MSG_WM_CLEAR(func) \
  1913. if (uMsg == WM_CLEAR) \
  1914. { \
  1915. this->SetMsgHandled(TRUE); \
  1916. func(); \
  1917. lResult = 0; \
  1918. if(this->IsMsgHandled()) \
  1919. return TRUE; \
  1920. }
  1921. // void OnCopy()
  1922. #define MSG_WM_COPY(func) \
  1923. if (uMsg == WM_COPY) \
  1924. { \
  1925. this->SetMsgHandled(TRUE); \
  1926. func(); \
  1927. lResult = 0; \
  1928. if(this->IsMsgHandled()) \
  1929. return TRUE; \
  1930. }
  1931. // void OnCut()
  1932. #define MSG_WM_CUT(func) \
  1933. if (uMsg == WM_CUT) \
  1934. { \
  1935. this->SetMsgHandled(TRUE); \
  1936. func(); \
  1937. lResult = 0; \
  1938. if(this->IsMsgHandled()) \
  1939. return TRUE; \
  1940. }
  1941. // void OnPaste()
  1942. #define MSG_WM_PASTE(func) \
  1943. if (uMsg == WM_PASTE) \
  1944. { \
  1945. this->SetMsgHandled(TRUE); \
  1946. func(); \
  1947. lResult = 0; \
  1948. if(this->IsMsgHandled()) \
  1949. return TRUE; \
  1950. }
  1951. // void OnUndo()
  1952. #define MSG_WM_UNDO(func) \
  1953. if (uMsg == WM_UNDO) \
  1954. { \
  1955. this->SetMsgHandled(TRUE); \
  1956. func(); \
  1957. lResult = 0; \
  1958. if(this->IsMsgHandled()) \
  1959. return TRUE; \
  1960. }
  1961. ///////////////////////////////////////////////////////////////////////////////
  1962. // Generic message handlers
  1963. // LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
  1964. #define MESSAGE_HANDLER_EX(msg, func) \
  1965. if(uMsg == msg) \
  1966. { \
  1967. this->SetMsgHandled(TRUE); \
  1968. lResult = func(uMsg, wParam, lParam); \
  1969. if(this->IsMsgHandled()) \
  1970. return TRUE; \
  1971. }
  1972. // LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
  1973. #define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \
  1974. if((uMsg >= msgFirst) && (uMsg <= msgLast)) \
  1975. { \
  1976. this->SetMsgHandled(TRUE); \
  1977. lResult = func(uMsg, wParam, lParam); \
  1978. if(this->IsMsgHandled()) \
  1979. return TRUE; \
  1980. }
  1981. ///////////////////////////////////////////////////////////////////////////////
  1982. // Commands and notifications
  1983. // void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  1984. #define COMMAND_HANDLER_EX(id, code, func) \
  1985. if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \
  1986. { \
  1987. this->SetMsgHandled(TRUE); \
  1988. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  1989. lResult = 0; \
  1990. if(this->IsMsgHandled()) \
  1991. return TRUE; \
  1992. }
  1993. // void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  1994. #define COMMAND_ID_HANDLER_EX(id, func) \
  1995. if ((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \
  1996. { \
  1997. this->SetMsgHandled(TRUE); \
  1998. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  1999. lResult = 0; \
  2000. if(this->IsMsgHandled()) \
  2001. return TRUE; \
  2002. }
  2003. // void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2004. #define COMMAND_CODE_HANDLER_EX(code, func) \
  2005. if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \
  2006. { \
  2007. this->SetMsgHandled(TRUE); \
  2008. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2009. lResult = 0; \
  2010. if(this->IsMsgHandled()) \
  2011. return TRUE; \
  2012. }
  2013. // LRESULT OnNotifyHandlerEX(LPNMHDR pnmh)
  2014. #define NOTIFY_HANDLER_EX(id, cd, func) \
  2015. if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2016. { \
  2017. this->SetMsgHandled(TRUE); \
  2018. lResult = func((LPNMHDR)lParam); \
  2019. if(this->IsMsgHandled()) \
  2020. return TRUE; \
  2021. }
  2022. // LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh)
  2023. #define NOTIFY_ID_HANDLER_EX(id, func) \
  2024. if ((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2025. { \
  2026. this->SetMsgHandled(TRUE); \
  2027. lResult = func((LPNMHDR)lParam); \
  2028. if(this->IsMsgHandled()) \
  2029. return TRUE; \
  2030. }
  2031. // LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh)
  2032. #define NOTIFY_CODE_HANDLER_EX(cd, func) \
  2033. if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
  2034. { \
  2035. this->SetMsgHandled(TRUE); \
  2036. lResult = func((LPNMHDR)lParam); \
  2037. if(this->IsMsgHandled()) \
  2038. return TRUE; \
  2039. }
  2040. // void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2041. #define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2042. if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2043. { \
  2044. this->SetMsgHandled(TRUE); \
  2045. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2046. lResult = 0; \
  2047. if(this->IsMsgHandled()) \
  2048. return TRUE; \
  2049. }
  2050. // void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2051. #define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
  2052. if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2053. { \
  2054. this->SetMsgHandled(TRUE); \
  2055. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2056. lResult = 0; \
  2057. if(this->IsMsgHandled()) \
  2058. return TRUE; \
  2059. }
  2060. // LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh)
  2061. #define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2062. if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2063. { \
  2064. this->SetMsgHandled(TRUE); \
  2065. lResult = func((LPNMHDR)lParam); \
  2066. if(this->IsMsgHandled()) \
  2067. return TRUE; \
  2068. }
  2069. // LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
  2070. #define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
  2071. if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2072. { \
  2073. this->SetMsgHandled(TRUE); \
  2074. lResult = func((LPNMHDR)lParam); \
  2075. if(this->IsMsgHandled()) \
  2076. return TRUE; \
  2077. }
  2078. // LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2079. #define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \
  2080. if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \
  2081. { \
  2082. this->SetMsgHandled(TRUE); \
  2083. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2084. lResult = 0; \
  2085. if(this->IsMsgHandled()) \
  2086. return TRUE; \
  2087. }
  2088. // LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2089. #define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \
  2090. if ((uMsg == OCM_COMMAND) && (id == LOWORD(wParam))) \
  2091. { \
  2092. this->SetMsgHandled(TRUE); \
  2093. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2094. lResult = 0; \
  2095. if(this->IsMsgHandled()) \
  2096. return TRUE; \
  2097. }
  2098. // LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2099. #define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \
  2100. if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam))) \
  2101. { \
  2102. this->SetMsgHandled(TRUE); \
  2103. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2104. lResult = 0; \
  2105. if(this->IsMsgHandled()) \
  2106. return TRUE; \
  2107. }
  2108. // LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh)
  2109. #define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \
  2110. if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2111. { \
  2112. this->SetMsgHandled(TRUE); \
  2113. lResult = func((LPNMHDR)lParam); \
  2114. if(this->IsMsgHandled()) \
  2115. return TRUE; \
  2116. }
  2117. // LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh)
  2118. #define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \
  2119. if ((uMsg == OCM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2120. { \
  2121. this->SetMsgHandled(TRUE); \
  2122. lResult = func((LPNMHDR)lParam); \
  2123. if(this->IsMsgHandled()) \
  2124. return TRUE; \
  2125. }
  2126. // LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh)
  2127. #define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \
  2128. if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
  2129. { \
  2130. this->SetMsgHandled(TRUE); \
  2131. lResult = func((LPNMHDR)lParam); \
  2132. if(this->IsMsgHandled()) \
  2133. return TRUE; \
  2134. }
  2135. // void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2136. #define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2137. if((uMsg == OCM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2138. { \
  2139. this->SetMsgHandled(TRUE); \
  2140. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2141. lResult = 0; \
  2142. if(this->IsMsgHandled()) \
  2143. return TRUE; \
  2144. }
  2145. // void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2146. #define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
  2147. if((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2148. { \
  2149. this->SetMsgHandled(TRUE); \
  2150. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2151. lResult = 0; \
  2152. if(this->IsMsgHandled()) \
  2153. return TRUE; \
  2154. }
  2155. // LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh)
  2156. #define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2157. if((uMsg == OCM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2158. { \
  2159. this->SetMsgHandled(TRUE); \
  2160. lResult = func((LPNMHDR)lParam); \
  2161. if(this->IsMsgHandled()) \
  2162. return TRUE; \
  2163. }
  2164. // LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
  2165. #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
  2166. if((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2167. { \
  2168. this->SetMsgHandled(TRUE); \
  2169. lResult = func((LPNMHDR)lParam); \
  2170. if(this->IsMsgHandled()) \
  2171. return TRUE; \
  2172. }
  2173. // void OnAppCommandHandler(UINT uDevice, DWORD dwKeys, CWindow wndFocus)
  2174. #define APPCOMMAND_HANDLER_EX(cmd, func) \
  2175. if((uMsg == WM_APPCOMMAND) && (cmd == GET_APPCOMMAND_LPARAM(lParam))) \
  2176. { \
  2177. this->SetMsgHandled(TRUE); \
  2178. func(GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam), (HWND)wParam); \
  2179. lResult = TRUE; \
  2180. if(this->IsMsgHandled()) \
  2181. return TRUE; \
  2182. }
  2183. #endif // __ATLCRACK_H__