atlcrack.h 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480
  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) \
  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 wndDeactivate, CWindow wndActivate)
  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 OnNcMouseHover(UINT nHitTest, CPoint ptPos)
  1479. #define MSG_WM_NCMOUSEHOVER(func) \
  1480. if (uMsg == WM_NCMOUSEHOVER) \
  1481. { \
  1482. this->SetMsgHandled(TRUE); \
  1483. func((UINT)wParam, ::CPoint(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y)); \
  1484. lResult = 0; \
  1485. if(this->IsMsgHandled()) \
  1486. return TRUE; \
  1487. }
  1488. // void OnNcMouseLeave()
  1489. #define MSG_WM_NCMOUSELEAVE(func) \
  1490. if (uMsg == WM_NCMOUSELEAVE) \
  1491. { \
  1492. this->SetMsgHandled(TRUE); \
  1493. func(); \
  1494. lResult = 0; \
  1495. if(this->IsMsgHandled()) \
  1496. return TRUE; \
  1497. }
  1498. // void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu)
  1499. #define MSG_WM_MENURBUTTONUP(func) \
  1500. if (uMsg == WM_MENURBUTTONUP) \
  1501. { \
  1502. this->SetMsgHandled(TRUE); \
  1503. func(wParam, (HMENU)lParam); \
  1504. lResult = 0; \
  1505. if(this->IsMsgHandled()) \
  1506. return TRUE; \
  1507. }
  1508. // LRESULT OnMenuDrag(WPARAM wParam, CMenuHandle menu)
  1509. #define MSG_WM_MENUDRAG(func) \
  1510. if (uMsg == WM_MENUDRAG) \
  1511. { \
  1512. this->SetMsgHandled(TRUE); \
  1513. lResult = func(wParam, (HMENU)lParam); \
  1514. if(this->IsMsgHandled()) \
  1515. return TRUE; \
  1516. }
  1517. // LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info)
  1518. #define MSG_WM_MENUGETOBJECT(func) \
  1519. if (uMsg == WM_MENUGETOBJECT) \
  1520. { \
  1521. this->SetMsgHandled(TRUE); \
  1522. lResult = func((PMENUGETOBJECTINFO)lParam); \
  1523. if(this->IsMsgHandled()) \
  1524. return TRUE; \
  1525. }
  1526. // void OnUnInitMenuPopup(UINT nID, CMenuHandle menu)
  1527. #define MSG_WM_UNINITMENUPOPUP(func) \
  1528. if (uMsg == WM_UNINITMENUPOPUP) \
  1529. { \
  1530. this->SetMsgHandled(TRUE); \
  1531. func((UINT)HIWORD(lParam), (HMENU)wParam); \
  1532. lResult = 0; \
  1533. if(this->IsMsgHandled()) \
  1534. return TRUE; \
  1535. }
  1536. // void OnMenuCommand(WPARAM nIndex, CMenuHandle menu)
  1537. #define MSG_WM_MENUCOMMAND(func) \
  1538. if (uMsg == WM_MENUCOMMAND) \
  1539. { \
  1540. this->SetMsgHandled(TRUE); \
  1541. func(wParam, (HMENU)lParam); \
  1542. lResult = 0; \
  1543. if(this->IsMsgHandled()) \
  1544. return TRUE; \
  1545. }
  1546. // BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys)
  1547. #define MSG_WM_APPCOMMAND(func) \
  1548. if (uMsg == WM_APPCOMMAND) \
  1549. { \
  1550. this->SetMsgHandled(TRUE); \
  1551. lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \
  1552. if(this->IsMsgHandled()) \
  1553. return TRUE; \
  1554. }
  1555. // void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos)
  1556. #define MSG_WM_NCXBUTTONDOWN(func) \
  1557. if (uMsg == WM_NCXBUTTONDOWN) \
  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 OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos)
  1566. #define MSG_WM_NCXBUTTONUP(func) \
  1567. if (uMsg == WM_NCXBUTTONUP) \
  1568. { \
  1569. this->SetMsgHandled(TRUE); \
  1570. func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_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 OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos)
  1576. #define MSG_WM_NCXBUTTONDBLCLK(func) \
  1577. if (uMsg == WM_NCXBUTTONDBLCLK) \
  1578. { \
  1579. this->SetMsgHandled(TRUE); \
  1580. func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_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 OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
  1586. #define MSG_WM_XBUTTONDOWN(func) \
  1587. if (uMsg == WM_XBUTTONDOWN) \
  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 OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos)
  1596. #define MSG_WM_XBUTTONUP(func) \
  1597. if (uMsg == WM_XBUTTONUP) \
  1598. { \
  1599. this->SetMsgHandled(TRUE); \
  1600. func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1601. lResult = (LRESULT)TRUE; \
  1602. if(this->IsMsgHandled()) \
  1603. return TRUE; \
  1604. }
  1605. // void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos)
  1606. #define MSG_WM_XBUTTONDBLCLK(func) \
  1607. if (uMsg == WM_XBUTTONDBLCLK) \
  1608. { \
  1609. this->SetMsgHandled(TRUE); \
  1610. func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1611. lResult = (LRESULT)TRUE; \
  1612. if(this->IsMsgHandled()) \
  1613. return TRUE; \
  1614. }
  1615. // void OnChangeUIState(WORD nAction, WORD nState)
  1616. #define MSG_WM_CHANGEUISTATE(func) \
  1617. if (uMsg == WM_CHANGEUISTATE) \
  1618. { \
  1619. this->SetMsgHandled(TRUE); \
  1620. func(LOWORD(wParam), HIWORD(wParam)); \
  1621. lResult = 0; \
  1622. if(this->IsMsgHandled()) \
  1623. return TRUE; \
  1624. }
  1625. // void OnUpdateUIState(WORD nAction, WORD nState)
  1626. #define MSG_WM_UPDATEUISTATE(func) \
  1627. if (uMsg == WM_UPDATEUISTATE) \
  1628. { \
  1629. this->SetMsgHandled(TRUE); \
  1630. func(LOWORD(wParam), HIWORD(wParam)); \
  1631. lResult = 0; \
  1632. if(this->IsMsgHandled()) \
  1633. return TRUE; \
  1634. }
  1635. // LRESULT OnQueryUIState()
  1636. #define MSG_WM_QUERYUISTATE(func) \
  1637. if (uMsg == WM_QUERYUISTATE) \
  1638. { \
  1639. this->SetMsgHandled(TRUE); \
  1640. lResult = func(); \
  1641. if(this->IsMsgHandled()) \
  1642. return TRUE; \
  1643. }
  1644. // void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput)
  1645. #define MSG_WM_INPUT(func) \
  1646. if (uMsg == WM_INPUT) \
  1647. { \
  1648. this->SetMsgHandled(TRUE); \
  1649. func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \
  1650. lResult = 0; \
  1651. if(this->IsMsgHandled()) \
  1652. return TRUE; \
  1653. }
  1654. // void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags)
  1655. #define MSG_WM_UNICHAR(func) \
  1656. if (uMsg == WM_UNICHAR) \
  1657. { \
  1658. this->SetMsgHandled(TRUE); \
  1659. func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
  1660. if(this->IsMsgHandled()) \
  1661. { \
  1662. lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \
  1663. return TRUE; \
  1664. } \
  1665. }
  1666. // void OnWTSSessionChange(WPARAM nStatusCode, DWORD dwSessionID)
  1667. #define MSG_WM_WTSSESSION_CHANGE(func) \
  1668. if (uMsg == WM_WTSSESSION_CHANGE) \
  1669. { \
  1670. this->SetMsgHandled(TRUE); \
  1671. func(wParam, (DWORD)lParam); \
  1672. lResult = 0; \
  1673. if(this->IsMsgHandled()) \
  1674. return TRUE; \
  1675. }
  1676. // void OnThemeChanged()
  1677. #define MSG_WM_THEMECHANGED(func) \
  1678. if (uMsg == WM_THEMECHANGED) \
  1679. { \
  1680. this->SetMsgHandled(TRUE); \
  1681. func(); \
  1682. lResult = 0; \
  1683. if(this->IsMsgHandled()) \
  1684. return TRUE; \
  1685. }
  1686. #if (_WIN32_WINNT >= 0x0600)
  1687. // BOOL OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt)
  1688. #define MSG_WM_MOUSEHWHEEL(func) \
  1689. if (uMsg == WM_MOUSEHWHEEL) \
  1690. { \
  1691. this->SetMsgHandled(TRUE); \
  1692. lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
  1693. if(this->IsMsgHandled()) \
  1694. return TRUE; \
  1695. }
  1696. #endif // (_WIN32_WINNT >= 0x0600)
  1697. #if (WINVER >= 0x0601)
  1698. // void OnGesture(ULONGLONG ullArguments, HGESTUREINFO hGestureInfo)
  1699. #define MSG_WM_GESTURE(func) \
  1700. if (uMsg == WM_GESTURE) \
  1701. { \
  1702. this->SetMsgHandled(TRUE); \
  1703. func((ULONGLONG)wParam, (HGESTUREINFO)lParam); \
  1704. lResult = 0; \
  1705. if(this->IsMsgHandled()) \
  1706. return TRUE; \
  1707. }
  1708. // void OnGestureNotify(PGESTURENOTIFYSTRUCT pGestureNotifyStruct)
  1709. #define MSG_WM_GESTURENOTIFY(func) \
  1710. if (uMsg == WM_GESTURENOTIFY) \
  1711. { \
  1712. func((PGESTURENOTIFYSTRUCT)lParam); \
  1713. }
  1714. // void OnDpiChanged(UINT nDpiX, UINT nDpiY, PRECT pRect)
  1715. #define MSG_WM_DPICHANGED(func) \
  1716. if (uMsg == WM_DPICHANGED) \
  1717. { \
  1718. this->SetMsgHandled(TRUE); \
  1719. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (PRECT)lParam); \
  1720. lResult = 0; \
  1721. if(this->IsMsgHandled()) \
  1722. return TRUE; \
  1723. }
  1724. #endif // (WINVER >= 0x0601)
  1725. #if (WINVER >= 0x0605)
  1726. // void OnDpiChangedBeforeParent()
  1727. #define MSG_WM_DPICHANGED_BEFOREPARENT(func) \
  1728. if (uMsg == WM_DPICHANGED_BEFOREPARENT) \
  1729. { \
  1730. this->SetMsgHandled(TRUE); \
  1731. func(); \
  1732. lResult = 0; \
  1733. if(this->IsMsgHandled()) \
  1734. return TRUE; \
  1735. }
  1736. // void OnDpiChangedAfterParent()
  1737. #define MSG_WM_DPICHANGED_AFTERPARENT(func) \
  1738. if (uMsg == WM_DPICHANGED_AFTERPARENT) \
  1739. { \
  1740. this->SetMsgHandled(TRUE); \
  1741. func(); \
  1742. lResult = 0; \
  1743. if(this->IsMsgHandled()) \
  1744. return TRUE; \
  1745. }
  1746. // BOOL OnGetDpiScaledSize(UINT uDpi, PSIZE pSize)
  1747. #define MSG_WM_GETDPISCALEDSIZE(func) \
  1748. if (uMsg == WM_GETDPISCALEDSIZE) \
  1749. { \
  1750. this->SetMsgHandled(TRUE); \
  1751. lResult = (LRESULT)func((UINT)wParam, (PSIZE)lParam); \
  1752. if(this->IsMsgHandled()) \
  1753. return TRUE; \
  1754. }
  1755. #endif // (WINVER >= 0x0605)
  1756. ///////////////////////////////////////////////////////////////////////////////
  1757. // ATL defined messages
  1758. // BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData)
  1759. #define MSG_WM_FORWARDMSG(func) \
  1760. if (uMsg == WM_FORWARDMSG) \
  1761. { \
  1762. this->SetMsgHandled(TRUE); \
  1763. lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \
  1764. if(this->IsMsgHandled()) \
  1765. return TRUE; \
  1766. }
  1767. ///////////////////////////////////////////////////////////////////////////////
  1768. // Dialog specific messages
  1769. // LRESULT OnDMGetDefID()
  1770. #define MSG_DM_GETDEFID(func) \
  1771. if (uMsg == DM_GETDEFID) \
  1772. { \
  1773. this->SetMsgHandled(TRUE); \
  1774. lResult = func(); \
  1775. if(this->IsMsgHandled()) \
  1776. return TRUE; \
  1777. }
  1778. // void OnDMSetDefID(UINT DefID)
  1779. #define MSG_DM_SETDEFID(func) \
  1780. if (uMsg == DM_SETDEFID) \
  1781. { \
  1782. this->SetMsgHandled(TRUE); \
  1783. func((UINT)wParam); \
  1784. lResult = TRUE; \
  1785. if(this->IsMsgHandled()) \
  1786. return TRUE; \
  1787. }
  1788. // void OnDMReposition()
  1789. #define MSG_DM_REPOSITION(func) \
  1790. if (uMsg == DM_REPOSITION) \
  1791. { \
  1792. this->SetMsgHandled(TRUE); \
  1793. func(); \
  1794. lResult = 0; \
  1795. if(this->IsMsgHandled()) \
  1796. return TRUE; \
  1797. }
  1798. ///////////////////////////////////////////////////////////////////////////////
  1799. // Reflected messages
  1800. // void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
  1801. #define MSG_OCM_COMMAND(func) \
  1802. if (uMsg == OCM_COMMAND) \
  1803. { \
  1804. this->SetMsgHandled(TRUE); \
  1805. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  1806. lResult = 0; \
  1807. if(this->IsMsgHandled()) \
  1808. return TRUE; \
  1809. }
  1810. // LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh)
  1811. #define MSG_OCM_NOTIFY(func) \
  1812. if (uMsg == OCM_NOTIFY) \
  1813. { \
  1814. this->SetMsgHandled(TRUE); \
  1815. lResult = func((int)wParam, (LPNMHDR)lParam); \
  1816. if(this->IsMsgHandled()) \
  1817. return TRUE; \
  1818. }
  1819. // void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam)
  1820. #define MSG_OCM_PARENTNOTIFY(func) \
  1821. if (uMsg == OCM_PARENTNOTIFY) \
  1822. { \
  1823. this->SetMsgHandled(TRUE); \
  1824. func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
  1825. lResult = 0; \
  1826. if(this->IsMsgHandled()) \
  1827. return TRUE; \
  1828. }
  1829. // void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  1830. #define MSG_OCM_DRAWITEM(func) \
  1831. if (uMsg == OCM_DRAWITEM) \
  1832. { \
  1833. this->SetMsgHandled(TRUE); \
  1834. func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
  1835. lResult = TRUE; \
  1836. if(this->IsMsgHandled()) \
  1837. return TRUE; \
  1838. }
  1839. // void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
  1840. #define MSG_OCM_MEASUREITEM(func) \
  1841. if (uMsg == OCM_MEASUREITEM) \
  1842. { \
  1843. this->SetMsgHandled(TRUE); \
  1844. func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
  1845. lResult = TRUE; \
  1846. if(this->IsMsgHandled()) \
  1847. return TRUE; \
  1848. }
  1849. // int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
  1850. #define MSG_OCM_COMPAREITEM(func) \
  1851. if (uMsg == OCM_COMPAREITEM) \
  1852. { \
  1853. this->SetMsgHandled(TRUE); \
  1854. lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
  1855. if(this->IsMsgHandled()) \
  1856. return TRUE; \
  1857. }
  1858. // void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
  1859. #define MSG_OCM_DELETEITEM(func) \
  1860. if (uMsg == OCM_DELETEITEM) \
  1861. { \
  1862. this->SetMsgHandled(TRUE); \
  1863. func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
  1864. lResult = TRUE; \
  1865. if(this->IsMsgHandled()) \
  1866. return TRUE; \
  1867. }
  1868. // int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
  1869. #define MSG_OCM_VKEYTOITEM(func) \
  1870. if (uMsg == OCM_VKEYTOITEM) \
  1871. { \
  1872. this->SetMsgHandled(TRUE); \
  1873. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  1874. if(this->IsMsgHandled()) \
  1875. return TRUE; \
  1876. }
  1877. //int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
  1878. #define MSG_OCM_CHARTOITEM(func) \
  1879. if (uMsg == OCM_CHARTOITEM) \
  1880. { \
  1881. this->SetMsgHandled(TRUE); \
  1882. lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
  1883. if(this->IsMsgHandled()) \
  1884. return TRUE; \
  1885. }
  1886. // void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  1887. #define MSG_OCM_HSCROLL(func) \
  1888. if (uMsg == OCM_HSCROLL) \
  1889. { \
  1890. this->SetMsgHandled(TRUE); \
  1891. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  1892. lResult = 0; \
  1893. if(this->IsMsgHandled()) \
  1894. return TRUE; \
  1895. }
  1896. // void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
  1897. #define MSG_OCM_VSCROLL(func) \
  1898. if (uMsg == OCM_VSCROLL) \
  1899. { \
  1900. this->SetMsgHandled(TRUE); \
  1901. func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
  1902. lResult = 0; \
  1903. if(this->IsMsgHandled()) \
  1904. return TRUE; \
  1905. }
  1906. // HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit)
  1907. #define MSG_OCM_CTLCOLOREDIT(func) \
  1908. if (uMsg == OCM_CTLCOLOREDIT) \
  1909. { \
  1910. this->SetMsgHandled(TRUE); \
  1911. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1912. if(this->IsMsgHandled()) \
  1913. return TRUE; \
  1914. }
  1915. // HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox)
  1916. #define MSG_OCM_CTLCOLORLISTBOX(func) \
  1917. if (uMsg == OCM_CTLCOLORLISTBOX) \
  1918. { \
  1919. this->SetMsgHandled(TRUE); \
  1920. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1921. if(this->IsMsgHandled()) \
  1922. return TRUE; \
  1923. }
  1924. // HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button)
  1925. #define MSG_OCM_CTLCOLORBTN(func) \
  1926. if (uMsg == OCM_CTLCOLORBTN) \
  1927. { \
  1928. this->SetMsgHandled(TRUE); \
  1929. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1930. if(this->IsMsgHandled()) \
  1931. return TRUE; \
  1932. }
  1933. // HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd)
  1934. #define MSG_OCM_CTLCOLORDLG(func) \
  1935. if (uMsg == OCM_CTLCOLORDLG) \
  1936. { \
  1937. this->SetMsgHandled(TRUE); \
  1938. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1939. if(this->IsMsgHandled()) \
  1940. return TRUE; \
  1941. }
  1942. // HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
  1943. #define MSG_OCM_CTLCOLORSCROLLBAR(func) \
  1944. if (uMsg == OCM_CTLCOLORSCROLLBAR) \
  1945. { \
  1946. this->SetMsgHandled(TRUE); \
  1947. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1948. if(this->IsMsgHandled()) \
  1949. return TRUE; \
  1950. }
  1951. // HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic)
  1952. #define MSG_OCM_CTLCOLORSTATIC(func) \
  1953. if (uMsg == OCM_CTLCOLORSTATIC) \
  1954. { \
  1955. this->SetMsgHandled(TRUE); \
  1956. lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
  1957. if(this->IsMsgHandled()) \
  1958. return TRUE; \
  1959. }
  1960. ///////////////////////////////////////////////////////////////////////////////
  1961. // Edit specific messages
  1962. // void OnClear()
  1963. #define MSG_WM_CLEAR(func) \
  1964. if (uMsg == WM_CLEAR) \
  1965. { \
  1966. this->SetMsgHandled(TRUE); \
  1967. func(); \
  1968. lResult = 0; \
  1969. if(this->IsMsgHandled()) \
  1970. return TRUE; \
  1971. }
  1972. // void OnCopy()
  1973. #define MSG_WM_COPY(func) \
  1974. if (uMsg == WM_COPY) \
  1975. { \
  1976. this->SetMsgHandled(TRUE); \
  1977. func(); \
  1978. lResult = 0; \
  1979. if(this->IsMsgHandled()) \
  1980. return TRUE; \
  1981. }
  1982. // void OnCut()
  1983. #define MSG_WM_CUT(func) \
  1984. if (uMsg == WM_CUT) \
  1985. { \
  1986. this->SetMsgHandled(TRUE); \
  1987. func(); \
  1988. lResult = 0; \
  1989. if(this->IsMsgHandled()) \
  1990. return TRUE; \
  1991. }
  1992. // void OnPaste()
  1993. #define MSG_WM_PASTE(func) \
  1994. if (uMsg == WM_PASTE) \
  1995. { \
  1996. this->SetMsgHandled(TRUE); \
  1997. func(); \
  1998. lResult = 0; \
  1999. if(this->IsMsgHandled()) \
  2000. return TRUE; \
  2001. }
  2002. // void OnUndo()
  2003. #define MSG_WM_UNDO(func) \
  2004. if (uMsg == WM_UNDO) \
  2005. { \
  2006. this->SetMsgHandled(TRUE); \
  2007. func(); \
  2008. lResult = 0; \
  2009. if(this->IsMsgHandled()) \
  2010. return TRUE; \
  2011. }
  2012. ///////////////////////////////////////////////////////////////////////////////
  2013. // Generic message handlers
  2014. // LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
  2015. #define MESSAGE_HANDLER_EX(msg, func) \
  2016. if(uMsg == msg) \
  2017. { \
  2018. this->SetMsgHandled(TRUE); \
  2019. lResult = func(uMsg, wParam, lParam); \
  2020. if(this->IsMsgHandled()) \
  2021. return TRUE; \
  2022. }
  2023. // LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
  2024. #define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \
  2025. if((uMsg >= msgFirst) && (uMsg <= msgLast)) \
  2026. { \
  2027. this->SetMsgHandled(TRUE); \
  2028. lResult = func(uMsg, wParam, lParam); \
  2029. if(this->IsMsgHandled()) \
  2030. return TRUE; \
  2031. }
  2032. ///////////////////////////////////////////////////////////////////////////////
  2033. // Commands and notifications
  2034. // void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2035. #define COMMAND_HANDLER_EX(id, code, func) \
  2036. if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \
  2037. { \
  2038. this->SetMsgHandled(TRUE); \
  2039. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2040. lResult = 0; \
  2041. if(this->IsMsgHandled()) \
  2042. return TRUE; \
  2043. }
  2044. // void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2045. #define COMMAND_ID_HANDLER_EX(id, func) \
  2046. if ((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \
  2047. { \
  2048. this->SetMsgHandled(TRUE); \
  2049. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2050. lResult = 0; \
  2051. if(this->IsMsgHandled()) \
  2052. return TRUE; \
  2053. }
  2054. // void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2055. #define COMMAND_CODE_HANDLER_EX(code, func) \
  2056. if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \
  2057. { \
  2058. this->SetMsgHandled(TRUE); \
  2059. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2060. lResult = 0; \
  2061. if(this->IsMsgHandled()) \
  2062. return TRUE; \
  2063. }
  2064. // LRESULT OnNotifyHandlerEX(LPNMHDR pnmh)
  2065. #define NOTIFY_HANDLER_EX(id, cd, func) \
  2066. if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2067. { \
  2068. this->SetMsgHandled(TRUE); \
  2069. lResult = func((LPNMHDR)lParam); \
  2070. if(this->IsMsgHandled()) \
  2071. return TRUE; \
  2072. }
  2073. // LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh)
  2074. #define NOTIFY_ID_HANDLER_EX(id, func) \
  2075. if ((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2076. { \
  2077. this->SetMsgHandled(TRUE); \
  2078. lResult = func((LPNMHDR)lParam); \
  2079. if(this->IsMsgHandled()) \
  2080. return TRUE; \
  2081. }
  2082. // LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh)
  2083. #define NOTIFY_CODE_HANDLER_EX(cd, func) \
  2084. if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
  2085. { \
  2086. this->SetMsgHandled(TRUE); \
  2087. lResult = func((LPNMHDR)lParam); \
  2088. if(this->IsMsgHandled()) \
  2089. return TRUE; \
  2090. }
  2091. // void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2092. #define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2093. if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2094. { \
  2095. this->SetMsgHandled(TRUE); \
  2096. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2097. lResult = 0; \
  2098. if(this->IsMsgHandled()) \
  2099. return TRUE; \
  2100. }
  2101. // void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2102. #define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
  2103. if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2104. { \
  2105. this->SetMsgHandled(TRUE); \
  2106. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2107. lResult = 0; \
  2108. if(this->IsMsgHandled()) \
  2109. return TRUE; \
  2110. }
  2111. // LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh)
  2112. #define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2113. if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2114. { \
  2115. this->SetMsgHandled(TRUE); \
  2116. lResult = func((LPNMHDR)lParam); \
  2117. if(this->IsMsgHandled()) \
  2118. return TRUE; \
  2119. }
  2120. // LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
  2121. #define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
  2122. if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2123. { \
  2124. this->SetMsgHandled(TRUE); \
  2125. lResult = func((LPNMHDR)lParam); \
  2126. if(this->IsMsgHandled()) \
  2127. return TRUE; \
  2128. }
  2129. // LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2130. #define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \
  2131. if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \
  2132. { \
  2133. this->SetMsgHandled(TRUE); \
  2134. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2135. lResult = 0; \
  2136. if(this->IsMsgHandled()) \
  2137. return TRUE; \
  2138. }
  2139. // LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2140. #define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \
  2141. if ((uMsg == OCM_COMMAND) && (id == LOWORD(wParam))) \
  2142. { \
  2143. this->SetMsgHandled(TRUE); \
  2144. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2145. lResult = 0; \
  2146. if(this->IsMsgHandled()) \
  2147. return TRUE; \
  2148. }
  2149. // LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2150. #define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \
  2151. if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam))) \
  2152. { \
  2153. this->SetMsgHandled(TRUE); \
  2154. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2155. lResult = 0; \
  2156. if(this->IsMsgHandled()) \
  2157. return TRUE; \
  2158. }
  2159. // LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh)
  2160. #define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \
  2161. if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2162. { \
  2163. this->SetMsgHandled(TRUE); \
  2164. lResult = func((LPNMHDR)lParam); \
  2165. if(this->IsMsgHandled()) \
  2166. return TRUE; \
  2167. }
  2168. // LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh)
  2169. #define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \
  2170. if ((uMsg == OCM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \
  2171. { \
  2172. this->SetMsgHandled(TRUE); \
  2173. lResult = func((LPNMHDR)lParam); \
  2174. if(this->IsMsgHandled()) \
  2175. return TRUE; \
  2176. }
  2177. // LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh)
  2178. #define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \
  2179. if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \
  2180. { \
  2181. this->SetMsgHandled(TRUE); \
  2182. lResult = func((LPNMHDR)lParam); \
  2183. if(this->IsMsgHandled()) \
  2184. return TRUE; \
  2185. }
  2186. // void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2187. #define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2188. if((uMsg == OCM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2189. { \
  2190. this->SetMsgHandled(TRUE); \
  2191. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2192. lResult = 0; \
  2193. if(this->IsMsgHandled()) \
  2194. return TRUE; \
  2195. }
  2196. // void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
  2197. #define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
  2198. if((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \
  2199. { \
  2200. this->SetMsgHandled(TRUE); \
  2201. func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
  2202. lResult = 0; \
  2203. if(this->IsMsgHandled()) \
  2204. return TRUE; \
  2205. }
  2206. // LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh)
  2207. #define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
  2208. if((uMsg == OCM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2209. { \
  2210. this->SetMsgHandled(TRUE); \
  2211. lResult = func((LPNMHDR)lParam); \
  2212. if(this->IsMsgHandled()) \
  2213. return TRUE; \
  2214. }
  2215. // LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
  2216. #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
  2217. if((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \
  2218. { \
  2219. this->SetMsgHandled(TRUE); \
  2220. lResult = func((LPNMHDR)lParam); \
  2221. if(this->IsMsgHandled()) \
  2222. return TRUE; \
  2223. }
  2224. // void OnAppCommandHandler(UINT uDevice, DWORD dwKeys, CWindow wndFocus)
  2225. #define APPCOMMAND_HANDLER_EX(cmd, func) \
  2226. if((uMsg == WM_APPCOMMAND) && (cmd == GET_APPCOMMAND_LPARAM(lParam))) \
  2227. { \
  2228. this->SetMsgHandled(TRUE); \
  2229. func(GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam), (HWND)wParam); \
  2230. lResult = TRUE; \
  2231. if(this->IsMsgHandled()) \
  2232. return TRUE; \
  2233. }
  2234. #endif // __ATLCRACK_H__