Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / wtl / include / atlcrack.h
blob7708843a02845c48f6b449613b151f110928d365
1 // Windows Template Library - WTL version 8.0
2 // Copyright (C) Microsoft Corporation. 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 Permissive License (Ms-PL) which can be found in the file
7 // Ms-PL.txt at the root of this distribution.
9 #ifndef __ATLCRACK_H__
10 #define __ATLCRACK_H__
12 #pragma once
15 ///////////////////////////////////////////////////////////////////////////////
16 // Message map macro for cracked handlers
18 // Note about message maps with cracked handlers:
19 // For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX.
20 // For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes,
21 // but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl.
23 #define BEGIN_MSG_MAP_EX(theClass) \
24 public: \
25 BOOL m_bMsgHandled; \
26 /* "handled" management for cracked handlers */ \
27 BOOL IsMsgHandled() const \
28 { \
29 return m_bMsgHandled; \
30 } \
31 void SetMsgHandled(BOOL bHandled) \
32 { \
33 m_bMsgHandled = bHandled; \
34 } \
35 BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \
36 { \
37 BOOL bOldMsgHandled = m_bMsgHandled; \
38 BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \
39 m_bMsgHandled = bOldMsgHandled; \
40 return bRet; \
41 } \
42 BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \
43 { \
44 BOOL bHandled = TRUE; \
45 hWnd; \
46 uMsg; \
47 wParam; \
48 lParam; \
49 lResult; \
50 bHandled; \
51 switch(dwMsgMapID) \
52 { \
53 case 0:
56 ///////////////////////////////////////////////////////////////////////////////
57 // Standard Windows message macros
59 // int OnCreate(LPCREATESTRUCT lpCreateStruct)
60 #define MSG_WM_CREATE(func) \
61 if (uMsg == WM_CREATE) \
62 { \
63 SetMsgHandled(TRUE); \
64 lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
65 if(IsMsgHandled()) \
66 return TRUE; \
69 // BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
70 #define MSG_WM_INITDIALOG(func) \
71 if (uMsg == WM_INITDIALOG) \
72 { \
73 SetMsgHandled(TRUE); \
74 lResult = (LRESULT)func((HWND)wParam, lParam); \
75 if(IsMsgHandled()) \
76 return TRUE; \
79 // BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct)
80 #define MSG_WM_COPYDATA(func) \
81 if (uMsg == WM_COPYDATA) \
82 { \
83 SetMsgHandled(TRUE); \
84 lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \
85 if(IsMsgHandled()) \
86 return TRUE; \
89 // void OnDestroy()
90 #define MSG_WM_DESTROY(func) \
91 if (uMsg == WM_DESTROY) \
92 { \
93 SetMsgHandled(TRUE); \
94 func(); \
95 lResult = 0; \
96 if(IsMsgHandled()) \
97 return TRUE; \
100 // void OnMove(CPoint ptPos)
101 #define MSG_WM_MOVE(func) \
102 if (uMsg == WM_MOVE) \
104 SetMsgHandled(TRUE); \
105 func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
106 lResult = 0; \
107 if(IsMsgHandled()) \
108 return TRUE; \
111 // void OnSize(UINT nType, CSize size)
112 #define MSG_WM_SIZE(func) \
113 if (uMsg == WM_SIZE) \
115 SetMsgHandled(TRUE); \
116 func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
117 lResult = 0; \
118 if(IsMsgHandled()) \
119 return TRUE; \
122 // void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther)
123 #define MSG_WM_ACTIVATE(func) \
124 if (uMsg == WM_ACTIVATE) \
126 SetMsgHandled(TRUE); \
127 func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \
128 lResult = 0; \
129 if(IsMsgHandled()) \
130 return TRUE; \
133 // void OnSetFocus(CWindow wndOld)
134 #define MSG_WM_SETFOCUS(func) \
135 if (uMsg == WM_SETFOCUS) \
137 SetMsgHandled(TRUE); \
138 func((HWND)wParam); \
139 lResult = 0; \
140 if(IsMsgHandled()) \
141 return TRUE; \
144 // void OnKillFocus(CWindow wndFocus)
145 #define MSG_WM_KILLFOCUS(func) \
146 if (uMsg == WM_KILLFOCUS) \
148 SetMsgHandled(TRUE); \
149 func((HWND)wParam); \
150 lResult = 0; \
151 if(IsMsgHandled()) \
152 return TRUE; \
155 // void OnEnable(BOOL bEnable)
156 #define MSG_WM_ENABLE(func) \
157 if (uMsg == WM_ENABLE) \
159 SetMsgHandled(TRUE); \
160 func((BOOL)wParam); \
161 lResult = 0; \
162 if(IsMsgHandled()) \
163 return TRUE; \
166 // void OnPaint(CDCHandle dc)
167 #define MSG_WM_PAINT(func) \
168 if (uMsg == WM_PAINT) \
170 SetMsgHandled(TRUE); \
171 func((HDC)wParam); \
172 lResult = 0; \
173 if(IsMsgHandled()) \
174 return TRUE; \
177 // void OnClose()
178 #define MSG_WM_CLOSE(func) \
179 if (uMsg == WM_CLOSE) \
181 SetMsgHandled(TRUE); \
182 func(); \
183 lResult = 0; \
184 if(IsMsgHandled()) \
185 return TRUE; \
188 // BOOL OnQueryEndSession(UINT nSource, UINT uLogOff)
189 #define MSG_WM_QUERYENDSESSION(func) \
190 if (uMsg == WM_QUERYENDSESSION) \
192 SetMsgHandled(TRUE); \
193 lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \
194 if(IsMsgHandled()) \
195 return TRUE; \
198 // BOOL OnQueryOpen()
199 #define MSG_WM_QUERYOPEN(func) \
200 if (uMsg == WM_QUERYOPEN) \
202 SetMsgHandled(TRUE); \
203 lResult = (LRESULT)func(); \
204 if(IsMsgHandled()) \
205 return TRUE; \
208 // BOOL OnEraseBkgnd(CDCHandle dc)
209 #define MSG_WM_ERASEBKGND(func) \
210 if (uMsg == WM_ERASEBKGND) \
212 SetMsgHandled(TRUE); \
213 lResult = (LRESULT)func((HDC)wParam); \
214 if(IsMsgHandled()) \
215 return TRUE; \
218 // void OnSysColorChange()
219 #define MSG_WM_SYSCOLORCHANGE(func) \
220 if (uMsg == WM_SYSCOLORCHANGE) \
222 SetMsgHandled(TRUE); \
223 func(); \
224 lResult = 0; \
225 if(IsMsgHandled()) \
226 return TRUE; \
229 // void OnEndSession(BOOL bEnding, UINT uLogOff)
230 #define MSG_WM_ENDSESSION(func) \
231 if (uMsg == WM_ENDSESSION) \
233 SetMsgHandled(TRUE); \
234 func((BOOL)wParam, (UINT)lParam); \
235 lResult = 0; \
236 if(IsMsgHandled()) \
237 return TRUE; \
240 // void OnShowWindow(BOOL bShow, UINT nStatus)
241 #define MSG_WM_SHOWWINDOW(func) \
242 if (uMsg == WM_SHOWWINDOW) \
244 SetMsgHandled(TRUE); \
245 func((BOOL)wParam, (int)lParam); \
246 lResult = 0; \
247 if(IsMsgHandled()) \
248 return TRUE; \
251 // HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit)
252 #define MSG_WM_CTLCOLOREDIT(func) \
253 if (uMsg == WM_CTLCOLOREDIT) \
255 SetMsgHandled(TRUE); \
256 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
257 if(IsMsgHandled()) \
258 return TRUE; \
261 // HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox)
262 #define MSG_WM_CTLCOLORLISTBOX(func) \
263 if (uMsg == WM_CTLCOLORLISTBOX) \
265 SetMsgHandled(TRUE); \
266 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
267 if(IsMsgHandled()) \
268 return TRUE; \
271 // HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button)
272 #define MSG_WM_CTLCOLORBTN(func) \
273 if (uMsg == WM_CTLCOLORBTN) \
275 SetMsgHandled(TRUE); \
276 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
277 if(IsMsgHandled()) \
278 return TRUE; \
281 // HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd)
282 #define MSG_WM_CTLCOLORDLG(func) \
283 if (uMsg == WM_CTLCOLORDLG) \
285 SetMsgHandled(TRUE); \
286 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
287 if(IsMsgHandled()) \
288 return TRUE; \
291 // HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
292 #define MSG_WM_CTLCOLORSCROLLBAR(func) \
293 if (uMsg == WM_CTLCOLORSCROLLBAR) \
295 SetMsgHandled(TRUE); \
296 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
297 if(IsMsgHandled()) \
298 return TRUE; \
301 // HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic)
302 #define MSG_WM_CTLCOLORSTATIC(func) \
303 if (uMsg == WM_CTLCOLORSTATIC) \
305 SetMsgHandled(TRUE); \
306 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
307 if(IsMsgHandled()) \
308 return TRUE; \
311 // void OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
312 #define MSG_WM_SETTINGCHANGE(func) \
313 if (uMsg == WM_SETTINGCHANGE) \
315 SetMsgHandled(TRUE); \
316 func((UINT)wParam, (LPCTSTR)lParam); \
317 lResult = 0; \
318 if(IsMsgHandled()) \
319 return TRUE; \
322 // void OnDevModeChange(LPCTSTR lpDeviceName)
323 #define MSG_WM_DEVMODECHANGE(func) \
324 if (uMsg == WM_DEVMODECHANGE) \
326 SetMsgHandled(TRUE); \
327 func((LPCTSTR)lParam); \
328 lResult = 0; \
329 if(IsMsgHandled()) \
330 return TRUE; \
333 // void OnActivateApp(BOOL bActive, DWORD dwThreadID)
334 #define MSG_WM_ACTIVATEAPP(func) \
335 if (uMsg == WM_ACTIVATEAPP) \
337 SetMsgHandled(TRUE); \
338 func((BOOL)wParam, (DWORD)lParam); \
339 lResult = 0; \
340 if(IsMsgHandled()) \
341 return TRUE; \
344 // void OnFontChange()
345 #define MSG_WM_FONTCHANGE(func) \
346 if (uMsg == WM_FONTCHANGE) \
348 SetMsgHandled(TRUE); \
349 func(); \
350 lResult = 0; \
351 if(IsMsgHandled()) \
352 return TRUE; \
355 // void OnTimeChange()
356 #define MSG_WM_TIMECHANGE(func) \
357 if (uMsg == WM_TIMECHANGE) \
359 SetMsgHandled(TRUE); \
360 func(); \
361 lResult = 0; \
362 if(IsMsgHandled()) \
363 return TRUE; \
366 // void OnCancelMode()
367 #define MSG_WM_CANCELMODE(func) \
368 if (uMsg == WM_CANCELMODE) \
370 SetMsgHandled(TRUE); \
371 func(); \
372 lResult = 0; \
373 if(IsMsgHandled()) \
374 return TRUE; \
377 // BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message)
378 #define MSG_WM_SETCURSOR(func) \
379 if (uMsg == WM_SETCURSOR) \
381 SetMsgHandled(TRUE); \
382 lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
383 if(IsMsgHandled()) \
384 return TRUE; \
387 // int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
388 #define MSG_WM_MOUSEACTIVATE(func) \
389 if (uMsg == WM_MOUSEACTIVATE) \
391 SetMsgHandled(TRUE); \
392 lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
393 if(IsMsgHandled()) \
394 return TRUE; \
397 // void OnChildActivate()
398 #define MSG_WM_CHILDACTIVATE(func) \
399 if (uMsg == WM_CHILDACTIVATE) \
401 SetMsgHandled(TRUE); \
402 func(); \
403 lResult = 0; \
404 if(IsMsgHandled()) \
405 return TRUE; \
408 // void OnGetMinMaxInfo(LPMINMAXINFO lpMMI)
409 #define MSG_WM_GETMINMAXINFO(func) \
410 if (uMsg == WM_GETMINMAXINFO) \
412 SetMsgHandled(TRUE); \
413 func((LPMINMAXINFO)lParam); \
414 lResult = 0; \
415 if(IsMsgHandled()) \
416 return TRUE; \
419 // void OnIconEraseBkgnd(CDCHandle dc)
420 #define MSG_WM_ICONERASEBKGND(func) \
421 if (uMsg == WM_ICONERASEBKGND) \
423 SetMsgHandled(TRUE); \
424 func((HDC)wParam); \
425 lResult = 0; \
426 if(IsMsgHandled()) \
427 return TRUE; \
430 // void OnSpoolerStatus(UINT nStatus, UINT nJobs)
431 #define MSG_WM_SPOOLERSTATUS(func) \
432 if (uMsg == WM_SPOOLERSTATUS) \
434 SetMsgHandled(TRUE); \
435 func((UINT)wParam, (UINT)LOWORD(lParam)); \
436 lResult = 0; \
437 if(IsMsgHandled()) \
438 return TRUE; \
441 // void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
442 #define MSG_WM_DRAWITEM(func) \
443 if (uMsg == WM_DRAWITEM) \
445 SetMsgHandled(TRUE); \
446 func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
447 lResult = TRUE; \
448 if(IsMsgHandled()) \
449 return TRUE; \
452 // void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
453 #define MSG_WM_MEASUREITEM(func) \
454 if (uMsg == WM_MEASUREITEM) \
456 SetMsgHandled(TRUE); \
457 func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
458 lResult = TRUE; \
459 if(IsMsgHandled()) \
460 return TRUE; \
463 // void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
464 #define MSG_WM_DELETEITEM(func) \
465 if (uMsg == WM_DELETEITEM) \
467 SetMsgHandled(TRUE); \
468 func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
469 lResult = TRUE; \
470 if(IsMsgHandled()) \
471 return TRUE; \
474 //int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
475 #define MSG_WM_CHARTOITEM(func) \
476 if (uMsg == WM_CHARTOITEM) \
478 SetMsgHandled(TRUE); \
479 lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
480 if(IsMsgHandled()) \
481 return TRUE; \
484 // int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
485 #define MSG_WM_VKEYTOITEM(func) \
486 if (uMsg == WM_VKEYTOITEM) \
488 SetMsgHandled(TRUE); \
489 lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
490 if(IsMsgHandled()) \
491 return TRUE; \
494 // HCURSOR OnQueryDragIcon()
495 #define MSG_WM_QUERYDRAGICON(func) \
496 if (uMsg == WM_QUERYDRAGICON) \
498 SetMsgHandled(TRUE); \
499 lResult = (LRESULT)func(); \
500 if(IsMsgHandled()) \
501 return TRUE; \
504 // int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
505 #define MSG_WM_COMPAREITEM(func) \
506 if (uMsg == WM_COMPAREITEM) \
508 SetMsgHandled(TRUE); \
509 lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
510 if(IsMsgHandled()) \
511 return TRUE; \
514 // void OnCompacting(UINT nCpuTime)
515 #define MSG_WM_COMPACTING(func) \
516 if (uMsg == WM_COMPACTING) \
518 SetMsgHandled(TRUE); \
519 func((UINT)wParam); \
520 lResult = 0; \
521 if(IsMsgHandled()) \
522 return TRUE; \
525 // BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct)
526 #define MSG_WM_NCCREATE(func) \
527 if (uMsg == WM_NCCREATE) \
529 SetMsgHandled(TRUE); \
530 lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
531 if(IsMsgHandled()) \
532 return TRUE; \
535 // void OnNcDestroy()
536 #define MSG_WM_NCDESTROY(func) \
537 if (uMsg == WM_NCDESTROY) \
539 SetMsgHandled(TRUE); \
540 func(); \
541 lResult = 0; \
542 if(IsMsgHandled()) \
543 return TRUE; \
546 // LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam)
547 #define MSG_WM_NCCALCSIZE(func) \
548 if (uMsg == WM_NCCALCSIZE) \
550 SetMsgHandled(TRUE); \
551 lResult = func((BOOL)wParam, lParam); \
552 if(IsMsgHandled()) \
553 return TRUE; \
556 // UINT OnNcHitTest(CPoint point)
557 #define MSG_WM_NCHITTEST(func) \
558 if (uMsg == WM_NCHITTEST) \
560 SetMsgHandled(TRUE); \
561 lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
562 if(IsMsgHandled()) \
563 return TRUE; \
566 // void OnNcPaint(CRgn rgn)
567 #define MSG_WM_NCPAINT(func) \
568 if (uMsg == WM_NCPAINT) \
570 SetMsgHandled(TRUE); \
571 func((HRGN)wParam); \
572 lResult = 0; \
573 if(IsMsgHandled()) \
574 return TRUE; \
577 // BOOL OnNcActivate(BOOL bActive)
578 #define MSG_WM_NCACTIVATE(func) \
579 if (uMsg == WM_NCACTIVATE) \
581 SetMsgHandled(TRUE); \
582 lResult = (LRESULT)func((BOOL)wParam); \
583 if(IsMsgHandled()) \
584 return TRUE; \
587 // UINT OnGetDlgCode(LPMSG lpMsg)
588 #define MSG_WM_GETDLGCODE(func) \
589 if (uMsg == WM_GETDLGCODE) \
591 SetMsgHandled(TRUE); \
592 lResult = (LRESULT)func((LPMSG)lParam); \
593 if(IsMsgHandled()) \
594 return TRUE; \
597 // void OnNcMouseMove(UINT nHitTest, CPoint point)
598 #define MSG_WM_NCMOUSEMOVE(func) \
599 if (uMsg == WM_NCMOUSEMOVE) \
601 SetMsgHandled(TRUE); \
602 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
603 lResult = 0; \
604 if(IsMsgHandled()) \
605 return TRUE; \
608 // void OnNcLButtonDown(UINT nHitTest, CPoint point)
609 #define MSG_WM_NCLBUTTONDOWN(func) \
610 if (uMsg == WM_NCLBUTTONDOWN) \
612 SetMsgHandled(TRUE); \
613 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
614 lResult = 0; \
615 if(IsMsgHandled()) \
616 return TRUE; \
619 // void OnNcLButtonUp(UINT nHitTest, CPoint point)
620 #define MSG_WM_NCLBUTTONUP(func) \
621 if (uMsg == WM_NCLBUTTONUP) \
623 SetMsgHandled(TRUE); \
624 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
625 lResult = 0; \
626 if(IsMsgHandled()) \
627 return TRUE; \
630 // void OnNcLButtonDblClk(UINT nHitTest, CPoint point)
631 #define MSG_WM_NCLBUTTONDBLCLK(func) \
632 if (uMsg == WM_NCLBUTTONDBLCLK) \
634 SetMsgHandled(TRUE); \
635 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
636 lResult = 0; \
637 if(IsMsgHandled()) \
638 return TRUE; \
641 // void OnNcRButtonDown(UINT nHitTest, CPoint point)
642 #define MSG_WM_NCRBUTTONDOWN(func) \
643 if (uMsg == WM_NCRBUTTONDOWN) \
645 SetMsgHandled(TRUE); \
646 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
647 lResult = 0; \
648 if(IsMsgHandled()) \
649 return TRUE; \
652 // void OnNcRButtonUp(UINT nHitTest, CPoint point)
653 #define MSG_WM_NCRBUTTONUP(func) \
654 if (uMsg == WM_NCRBUTTONUP) \
656 SetMsgHandled(TRUE); \
657 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
658 lResult = 0; \
659 if(IsMsgHandled()) \
660 return TRUE; \
663 // void OnNcRButtonDblClk(UINT nHitTest, CPoint point)
664 #define MSG_WM_NCRBUTTONDBLCLK(func) \
665 if (uMsg == WM_NCRBUTTONDBLCLK) \
667 SetMsgHandled(TRUE); \
668 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
669 lResult = 0; \
670 if(IsMsgHandled()) \
671 return TRUE; \
674 // void OnNcMButtonDown(UINT nHitTest, CPoint point)
675 #define MSG_WM_NCMBUTTONDOWN(func) \
676 if (uMsg == WM_NCMBUTTONDOWN) \
678 SetMsgHandled(TRUE); \
679 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
680 lResult = 0; \
681 if(IsMsgHandled()) \
682 return TRUE; \
685 // void OnNcMButtonUp(UINT nHitTest, CPoint point)
686 #define MSG_WM_NCMBUTTONUP(func) \
687 if (uMsg == WM_NCMBUTTONUP) \
689 SetMsgHandled(TRUE); \
690 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
691 lResult = 0; \
692 if(IsMsgHandled()) \
693 return TRUE; \
696 // void OnNcMButtonDblClk(UINT nHitTest, CPoint point)
697 #define MSG_WM_NCMBUTTONDBLCLK(func) \
698 if (uMsg == WM_NCMBUTTONDBLCLK) \
700 SetMsgHandled(TRUE); \
701 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
702 lResult = 0; \
703 if(IsMsgHandled()) \
704 return TRUE; \
707 // void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
708 #define MSG_WM_KEYDOWN(func) \
709 if (uMsg == WM_KEYDOWN) \
711 SetMsgHandled(TRUE); \
712 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
713 lResult = 0; \
714 if(IsMsgHandled()) \
715 return TRUE; \
718 // void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
719 #define MSG_WM_KEYUP(func) \
720 if (uMsg == WM_KEYUP) \
722 SetMsgHandled(TRUE); \
723 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
724 lResult = 0; \
725 if(IsMsgHandled()) \
726 return TRUE; \
729 // void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
730 #define MSG_WM_CHAR(func) \
731 if (uMsg == WM_CHAR) \
733 SetMsgHandled(TRUE); \
734 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
735 lResult = 0; \
736 if(IsMsgHandled()) \
737 return TRUE; \
740 // void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
741 #define MSG_WM_DEADCHAR(func) \
742 if (uMsg == WM_DEADCHAR) \
744 SetMsgHandled(TRUE); \
745 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
746 lResult = 0; \
747 if(IsMsgHandled()) \
748 return TRUE; \
751 // void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
752 #define MSG_WM_SYSKEYDOWN(func) \
753 if (uMsg == WM_SYSKEYDOWN) \
755 SetMsgHandled(TRUE); \
756 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
757 lResult = 0; \
758 if(IsMsgHandled()) \
759 return TRUE; \
762 // void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
763 #define MSG_WM_SYSKEYUP(func) \
764 if (uMsg == WM_SYSKEYUP) \
766 SetMsgHandled(TRUE); \
767 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
768 lResult = 0; \
769 if(IsMsgHandled()) \
770 return TRUE; \
773 // void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags)
774 #define MSG_WM_SYSCHAR(func) \
775 if (uMsg == WM_SYSCHAR) \
777 SetMsgHandled(TRUE); \
778 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
779 lResult = 0; \
780 if(IsMsgHandled()) \
781 return TRUE; \
784 // void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
785 #define MSG_WM_SYSDEADCHAR(func) \
786 if (uMsg == WM_SYSDEADCHAR) \
788 SetMsgHandled(TRUE); \
789 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
790 lResult = 0; \
791 if(IsMsgHandled()) \
792 return TRUE; \
795 // void OnSysCommand(UINT nID, LPARAM lParam)
796 #define MSG_WM_SYSCOMMAND(func) \
797 if (uMsg == WM_SYSCOMMAND) \
799 SetMsgHandled(TRUE); \
800 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
801 lResult = 0; \
802 if(IsMsgHandled()) \
803 return TRUE; \
806 // void OnTCard(UINT idAction, DWORD dwActionData)
807 #define MSG_WM_TCARD(func) \
808 if (uMsg == WM_TCARD) \
810 SetMsgHandled(TRUE); \
811 func((UINT)wParam, (DWORD)lParam); \
812 lResult = 0; \
813 if(IsMsgHandled()) \
814 return TRUE; \
817 // void OnTimer(UINT_PTR nIDEvent)
818 #define MSG_WM_TIMER(func) \
819 if (uMsg == WM_TIMER) \
821 SetMsgHandled(TRUE); \
822 func((UINT_PTR)wParam); \
823 lResult = 0; \
824 if(IsMsgHandled()) \
825 return TRUE; \
828 // void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
829 #define MSG_WM_HSCROLL(func) \
830 if (uMsg == WM_HSCROLL) \
832 SetMsgHandled(TRUE); \
833 func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
834 lResult = 0; \
835 if(IsMsgHandled()) \
836 return TRUE; \
839 // void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
840 #define MSG_WM_VSCROLL(func) \
841 if (uMsg == WM_VSCROLL) \
843 SetMsgHandled(TRUE); \
844 func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
845 lResult = 0; \
846 if(IsMsgHandled()) \
847 return TRUE; \
850 // void OnInitMenu(CMenu menu)
851 #define MSG_WM_INITMENU(func) \
852 if (uMsg == WM_INITMENU) \
854 SetMsgHandled(TRUE); \
855 func((HMENU)wParam); \
856 lResult = 0; \
857 if(IsMsgHandled()) \
858 return TRUE; \
861 // void OnInitMenuPopup(CMenu menuPopup, UINT nIndex, BOOL bSysMenu)
862 #define MSG_WM_INITMENUPOPUP(func) \
863 if (uMsg == WM_INITMENUPOPUP) \
865 SetMsgHandled(TRUE); \
866 func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \
867 lResult = 0; \
868 if(IsMsgHandled()) \
869 return TRUE; \
872 // void OnMenuSelect(UINT nItemID, UINT nFlags, CMenu menu)
873 #define MSG_WM_MENUSELECT(func) \
874 if (uMsg == WM_MENUSELECT) \
876 SetMsgHandled(TRUE); \
877 func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
878 lResult = 0; \
879 if(IsMsgHandled()) \
880 return TRUE; \
883 // LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu menu)
884 #define MSG_WM_MENUCHAR(func) \
885 if (uMsg == WM_MENUCHAR) \
887 SetMsgHandled(TRUE); \
888 lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
889 if(IsMsgHandled()) \
890 return TRUE; \
893 // LRESULT OnNotify(int idCtrl, LPNMHDR pnmh)
894 #define MSG_WM_NOTIFY(func) \
895 if (uMsg == WM_NOTIFY) \
897 SetMsgHandled(TRUE); \
898 lResult = func((int)wParam, (LPNMHDR)lParam); \
899 if(IsMsgHandled()) \
900 return TRUE; \
903 // void OnEnterIdle(UINT nWhy, CWindow wndWho)
904 #define MSG_WM_ENTERIDLE(func) \
905 if (uMsg == WM_ENTERIDLE) \
907 SetMsgHandled(TRUE); \
908 func((UINT)wParam, (HWND)lParam); \
909 lResult = 0; \
910 if(IsMsgHandled()) \
911 return TRUE; \
914 // void OnMouseMove(UINT nFlags, CPoint point)
915 #define MSG_WM_MOUSEMOVE(func) \
916 if (uMsg == WM_MOUSEMOVE) \
918 SetMsgHandled(TRUE); \
919 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
920 lResult = 0; \
921 if(IsMsgHandled()) \
922 return TRUE; \
925 // BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
926 #define MSG_WM_MOUSEWHEEL(func) \
927 if (uMsg == WM_MOUSEWHEEL) \
929 SetMsgHandled(TRUE); \
930 lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
931 if(IsMsgHandled()) \
932 return TRUE; \
935 // void OnLButtonDown(UINT nFlags, CPoint point)
936 #define MSG_WM_LBUTTONDOWN(func) \
937 if (uMsg == WM_LBUTTONDOWN) \
939 SetMsgHandled(TRUE); \
940 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
941 lResult = 0; \
942 if(IsMsgHandled()) \
943 return TRUE; \
946 // void OnLButtonUp(UINT nFlags, CPoint point)
947 #define MSG_WM_LBUTTONUP(func) \
948 if (uMsg == WM_LBUTTONUP) \
950 SetMsgHandled(TRUE); \
951 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
952 lResult = 0; \
953 if(IsMsgHandled()) \
954 return TRUE; \
957 // void OnLButtonDblClk(UINT nFlags, CPoint point)
958 #define MSG_WM_LBUTTONDBLCLK(func) \
959 if (uMsg == WM_LBUTTONDBLCLK) \
961 SetMsgHandled(TRUE); \
962 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
963 lResult = 0; \
964 if(IsMsgHandled()) \
965 return TRUE; \
968 // void OnRButtonDown(UINT nFlags, CPoint point)
969 #define MSG_WM_RBUTTONDOWN(func) \
970 if (uMsg == WM_RBUTTONDOWN) \
972 SetMsgHandled(TRUE); \
973 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
974 lResult = 0; \
975 if(IsMsgHandled()) \
976 return TRUE; \
979 // void OnRButtonUp(UINT nFlags, CPoint point)
980 #define MSG_WM_RBUTTONUP(func) \
981 if (uMsg == WM_RBUTTONUP) \
983 SetMsgHandled(TRUE); \
984 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
985 lResult = 0; \
986 if(IsMsgHandled()) \
987 return TRUE; \
990 // void OnRButtonDblClk(UINT nFlags, CPoint point)
991 #define MSG_WM_RBUTTONDBLCLK(func) \
992 if (uMsg == WM_RBUTTONDBLCLK) \
994 SetMsgHandled(TRUE); \
995 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
996 lResult = 0; \
997 if(IsMsgHandled()) \
998 return TRUE; \
1001 // void OnMButtonDown(UINT nFlags, CPoint point)
1002 #define MSG_WM_MBUTTONDOWN(func) \
1003 if (uMsg == WM_MBUTTONDOWN) \
1005 SetMsgHandled(TRUE); \
1006 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1007 lResult = 0; \
1008 if(IsMsgHandled()) \
1009 return TRUE; \
1012 // void OnMButtonUp(UINT nFlags, CPoint point)
1013 #define MSG_WM_MBUTTONUP(func) \
1014 if (uMsg == WM_MBUTTONUP) \
1016 SetMsgHandled(TRUE); \
1017 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1018 lResult = 0; \
1019 if(IsMsgHandled()) \
1020 return TRUE; \
1023 // void OnMButtonDblClk(UINT nFlags, CPoint point)
1024 #define MSG_WM_MBUTTONDBLCLK(func) \
1025 if (uMsg == WM_MBUTTONDBLCLK) \
1027 SetMsgHandled(TRUE); \
1028 func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1029 lResult = 0; \
1030 if(IsMsgHandled()) \
1031 return TRUE; \
1034 // void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam)
1035 #define MSG_WM_PARENTNOTIFY(func) \
1036 if (uMsg == WM_PARENTNOTIFY) \
1038 SetMsgHandled(TRUE); \
1039 func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
1040 lResult = 0; \
1041 if(IsMsgHandled()) \
1042 return TRUE; \
1045 // void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate)
1046 #define MSG_WM_MDIACTIVATE(func) \
1047 if (uMsg == WM_MDIACTIVATE) \
1049 SetMsgHandled(TRUE); \
1050 func((HWND)wParam, (HWND)lParam); \
1051 lResult = 0; \
1052 if(IsMsgHandled()) \
1053 return TRUE; \
1056 // void OnRenderFormat(UINT nFormat)
1057 #define MSG_WM_RENDERFORMAT(func) \
1058 if (uMsg == WM_RENDERFORMAT) \
1060 SetMsgHandled(TRUE); \
1061 func((UINT)wParam); \
1062 lResult = 0; \
1063 if(IsMsgHandled()) \
1064 return TRUE; \
1067 // void OnRenderAllFormats()
1068 #define MSG_WM_RENDERALLFORMATS(func) \
1069 if (uMsg == WM_RENDERALLFORMATS) \
1071 SetMsgHandled(TRUE); \
1072 func(); \
1073 lResult = 0; \
1074 if(IsMsgHandled()) \
1075 return TRUE; \
1078 // void OnDestroyClipboard()
1079 #define MSG_WM_DESTROYCLIPBOARD(func) \
1080 if (uMsg == WM_DESTROYCLIPBOARD) \
1082 SetMsgHandled(TRUE); \
1083 func(); \
1084 lResult = 0; \
1085 if(IsMsgHandled()) \
1086 return TRUE; \
1089 // void OnDrawClipboard()
1090 #define MSG_WM_DRAWCLIPBOARD(func) \
1091 if (uMsg == WM_DRAWCLIPBOARD) \
1093 SetMsgHandled(TRUE); \
1094 func(); \
1095 lResult = 0; \
1096 if(IsMsgHandled()) \
1097 return TRUE; \
1100 // void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct)
1101 #define MSG_WM_PAINTCLIPBOARD(func) \
1102 if (uMsg == WM_PAINTCLIPBOARD) \
1104 SetMsgHandled(TRUE); \
1105 func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \
1106 ::GlobalUnlock((HGLOBAL)lParam); \
1107 lResult = 0; \
1108 if(IsMsgHandled()) \
1109 return TRUE; \
1112 // void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
1113 #define MSG_WM_VSCROLLCLIPBOARD(func) \
1114 if (uMsg == WM_VSCROLLCLIPBOARD) \
1116 SetMsgHandled(TRUE); \
1117 func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
1118 lResult = 0; \
1119 if(IsMsgHandled()) \
1120 return TRUE; \
1123 // void OnContextMenu(CWindow wnd, CPoint point)
1124 #define MSG_WM_CONTEXTMENU(func) \
1125 if (uMsg == WM_CONTEXTMENU) \
1127 SetMsgHandled(TRUE); \
1128 func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1129 lResult = 0; \
1130 if(IsMsgHandled()) \
1131 return TRUE; \
1134 // void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect)
1135 #define MSG_WM_SIZECLIPBOARD(func) \
1136 if (uMsg == WM_SIZECLIPBOARD) \
1138 SetMsgHandled(TRUE); \
1139 func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \
1140 ::GlobalUnlock((HGLOBAL)lParam); \
1141 lResult = 0; \
1142 if(IsMsgHandled()) \
1143 return TRUE; \
1146 // void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString)
1147 #define MSG_WM_ASKCBFORMATNAME(func) \
1148 if (uMsg == WM_ASKCBFORMATNAME) \
1150 SetMsgHandled(TRUE); \
1151 func((DWORD)wParam, (LPTSTR)lParam); \
1152 lResult = 0; \
1153 if(IsMsgHandled()) \
1154 return TRUE; \
1157 // void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter)
1158 #define MSG_WM_CHANGECBCHAIN(func) \
1159 if (uMsg == WM_CHANGECBCHAIN) \
1161 SetMsgHandled(TRUE); \
1162 func((HWND)wParam, (HWND)lParam); \
1163 lResult = 0; \
1164 if(IsMsgHandled()) \
1165 return TRUE; \
1168 // void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
1169 #define MSG_WM_HSCROLLCLIPBOARD(func) \
1170 if (uMsg == WM_HSCROLLCLIPBOARD) \
1172 SetMsgHandled(TRUE); \
1173 func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
1174 lResult = 0; \
1175 if(IsMsgHandled()) \
1176 return TRUE; \
1179 // BOOL OnQueryNewPalette()
1180 #define MSG_WM_QUERYNEWPALETTE(func) \
1181 if (uMsg == WM_QUERYNEWPALETTE) \
1183 SetMsgHandled(TRUE); \
1184 lResult = (LRESULT)func(); \
1185 if(IsMsgHandled()) \
1186 return TRUE; \
1189 // void OnPaletteChanged(CWindow wndFocus)
1190 #define MSG_WM_PALETTECHANGED(func) \
1191 if (uMsg == WM_PALETTECHANGED) \
1193 SetMsgHandled(TRUE); \
1194 func((HWND)wParam); \
1195 lResult = 0; \
1196 if(IsMsgHandled()) \
1197 return TRUE; \
1200 // void OnPaletteIsChanging(CWindow wndPalChg)
1201 #define MSG_WM_PALETTEISCHANGING(func) \
1202 if (uMsg == WM_PALETTEISCHANGING) \
1204 SetMsgHandled(TRUE); \
1205 func((HWND)wParam); \
1206 lResult = 0; \
1207 if(IsMsgHandled()) \
1208 return TRUE; \
1211 // void OnDropFiles(HDROP hDropInfo)
1212 #define MSG_WM_DROPFILES(func) \
1213 if (uMsg == WM_DROPFILES) \
1215 SetMsgHandled(TRUE); \
1216 func((HDROP)wParam); \
1217 lResult = 0; \
1218 if(IsMsgHandled()) \
1219 return TRUE; \
1222 // void OnWindowPosChanging(LPWINDOWPOS lpWndPos)
1223 #define MSG_WM_WINDOWPOSCHANGING(func) \
1224 if (uMsg == WM_WINDOWPOSCHANGING) \
1226 SetMsgHandled(TRUE); \
1227 func((LPWINDOWPOS)lParam); \
1228 lResult = 0; \
1229 if(IsMsgHandled()) \
1230 return TRUE; \
1233 // void OnWindowPosChanged(LPWINDOWPOS lpWndPos)
1234 #define MSG_WM_WINDOWPOSCHANGED(func) \
1235 if (uMsg == WM_WINDOWPOSCHANGED) \
1237 SetMsgHandled(TRUE); \
1238 func((LPWINDOWPOS)lParam); \
1239 lResult = 0; \
1240 if(IsMsgHandled()) \
1241 return TRUE; \
1244 // void OnExitMenuLoop(BOOL fIsTrackPopupMenu)
1245 #define MSG_WM_EXITMENULOOP(func) \
1246 if (uMsg == WM_EXITMENULOOP) \
1248 SetMsgHandled(TRUE); \
1249 func((BOOL)wParam); \
1250 lResult = 0; \
1251 if(IsMsgHandled()) \
1252 return TRUE; \
1255 // void OnEnterMenuLoop(BOOL fIsTrackPopupMenu)
1256 #define MSG_WM_ENTERMENULOOP(func) \
1257 if (uMsg == WM_ENTERMENULOOP) \
1259 SetMsgHandled(TRUE); \
1260 func((BOOL)wParam); \
1261 lResult = 0; \
1262 if(IsMsgHandled()) \
1263 return TRUE; \
1266 // void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
1267 #define MSG_WM_STYLECHANGED(func) \
1268 if (uMsg == WM_STYLECHANGED) \
1270 SetMsgHandled(TRUE); \
1271 func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
1272 lResult = 0; \
1273 if(IsMsgHandled()) \
1274 return TRUE; \
1277 // void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
1278 #define MSG_WM_STYLECHANGING(func) \
1279 if (uMsg == WM_STYLECHANGING) \
1281 SetMsgHandled(TRUE); \
1282 func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
1283 lResult = 0; \
1284 if(IsMsgHandled()) \
1285 return TRUE; \
1288 // void OnSizing(UINT fwSide, LPRECT pRect)
1289 #define MSG_WM_SIZING(func) \
1290 if (uMsg == WM_SIZING) \
1292 SetMsgHandled(TRUE); \
1293 func((UINT)wParam, (LPRECT)lParam); \
1294 lResult = TRUE; \
1295 if(IsMsgHandled()) \
1296 return TRUE; \
1299 // void OnMoving(UINT fwSide, LPRECT pRect)
1300 #define MSG_WM_MOVING(func) \
1301 if (uMsg == WM_MOVING) \
1303 SetMsgHandled(TRUE); \
1304 func((UINT)wParam, (LPRECT)lParam); \
1305 lResult = TRUE; \
1306 if(IsMsgHandled()) \
1307 return TRUE; \
1310 // void OnCaptureChanged(CWindow wnd)
1311 #define MSG_WM_CAPTURECHANGED(func) \
1312 if (uMsg == WM_CAPTURECHANGED) \
1314 SetMsgHandled(TRUE); \
1315 func((HWND)lParam); \
1316 lResult = 0; \
1317 if(IsMsgHandled()) \
1318 return TRUE; \
1321 // BOOL OnDeviceChange(UINT nEventType, DWORD dwData)
1322 #define MSG_WM_DEVICECHANGE(func) \
1323 if (uMsg == WM_DEVICECHANGE) \
1325 SetMsgHandled(TRUE); \
1326 lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \
1327 if(IsMsgHandled()) \
1328 return TRUE; \
1331 // void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
1332 #define MSG_WM_COMMAND(func) \
1333 if (uMsg == WM_COMMAND) \
1335 SetMsgHandled(TRUE); \
1336 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
1337 lResult = 0; \
1338 if(IsMsgHandled()) \
1339 return TRUE; \
1342 // void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen)
1343 #define MSG_WM_DISPLAYCHANGE(func) \
1344 if (uMsg == WM_DISPLAYCHANGE) \
1346 SetMsgHandled(TRUE); \
1347 func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1348 lResult = 0; \
1349 if(IsMsgHandled()) \
1350 return TRUE; \
1353 // void OnEnterSizeMove()
1354 #define MSG_WM_ENTERSIZEMOVE(func) \
1355 if (uMsg == WM_ENTERSIZEMOVE) \
1357 SetMsgHandled(TRUE); \
1358 func(); \
1359 lResult = 0; \
1360 if(IsMsgHandled()) \
1361 return TRUE; \
1364 // void OnExitSizeMove()
1365 #define MSG_WM_EXITSIZEMOVE(func) \
1366 if (uMsg == WM_EXITSIZEMOVE) \
1368 SetMsgHandled(TRUE); \
1369 func(); \
1370 lResult = 0; \
1371 if(IsMsgHandled()) \
1372 return TRUE; \
1375 // HFONT OnGetFont()
1376 #define MSG_WM_GETFONT(func) \
1377 if (uMsg == WM_GETFONT) \
1379 SetMsgHandled(TRUE); \
1380 lResult = (LRESULT)func(); \
1381 if(IsMsgHandled()) \
1382 return TRUE; \
1385 // LRESULT OnGetHotKey()
1386 #define MSG_WM_GETHOTKEY(func) \
1387 if (uMsg == WM_GETHOTKEY) \
1389 SetMsgHandled(TRUE); \
1390 lResult = func(); \
1391 if(IsMsgHandled()) \
1392 return TRUE; \
1395 // HICON OnGetIcon()
1396 #define MSG_WM_GETICON(func) \
1397 if (uMsg == WM_GETICON) \
1399 SetMsgHandled(TRUE); \
1400 lResult = (LRESULT)func((UINT)wParam); \
1401 if(IsMsgHandled()) \
1402 return TRUE; \
1405 // int OnGetText(int cchTextMax, LPTSTR lpszText)
1406 #define MSG_WM_GETTEXT(func) \
1407 if (uMsg == WM_GETTEXT) \
1409 SetMsgHandled(TRUE); \
1410 lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \
1411 if(IsMsgHandled()) \
1412 return TRUE; \
1415 // int OnGetTextLength()
1416 #define MSG_WM_GETTEXTLENGTH(func) \
1417 if (uMsg == WM_GETTEXTLENGTH) \
1419 SetMsgHandled(TRUE); \
1420 lResult = (LRESULT)func(); \
1421 if(IsMsgHandled()) \
1422 return TRUE; \
1425 // void OnHelp(LPHELPINFO lpHelpInfo)
1426 #define MSG_WM_HELP(func) \
1427 if (uMsg == WM_HELP) \
1429 SetMsgHandled(TRUE); \
1430 func((LPHELPINFO)lParam); \
1431 lResult = TRUE; \
1432 if(IsMsgHandled()) \
1433 return TRUE; \
1436 // void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey)
1437 #define MSG_WM_HOTKEY(func) \
1438 if (uMsg == WM_HOTKEY) \
1440 SetMsgHandled(TRUE); \
1441 func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
1442 lResult = 0; \
1443 if(IsMsgHandled()) \
1444 return TRUE; \
1447 // void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout)
1448 #define MSG_WM_INPUTLANGCHANGE(func) \
1449 if (uMsg == WM_INPUTLANGCHANGE) \
1451 SetMsgHandled(TRUE); \
1452 func((DWORD)wParam, (HKL)lParam); \
1453 lResult = TRUE; \
1454 if(IsMsgHandled()) \
1455 return TRUE; \
1458 // void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout)
1459 #define MSG_WM_INPUTLANGCHANGEREQUEST(func) \
1460 if (uMsg == WM_INPUTLANGCHANGEREQUEST) \
1462 SetMsgHandled(TRUE); \
1463 func((BOOL)wParam, (HKL)lParam); \
1464 lResult = 0; \
1465 if(IsMsgHandled()) \
1466 return TRUE; \
1469 // void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus)
1470 #define MSG_WM_NEXTDLGCTL(func) \
1471 if (uMsg == WM_NEXTDLGCTL) \
1473 SetMsgHandled(TRUE); \
1474 func((BOOL)LOWORD(lParam), wParam); \
1475 lResult = 0; \
1476 if(IsMsgHandled()) \
1477 return TRUE; \
1480 // void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu)
1481 #define MSG_WM_NEXTMENU(func) \
1482 if (uMsg == WM_NEXTMENU) \
1484 SetMsgHandled(TRUE); \
1485 func((int)wParam, (LPMDINEXTMENU)lParam); \
1486 lResult = 0; \
1487 if(IsMsgHandled()) \
1488 return TRUE; \
1491 // int OnNotifyFormat(CWindow wndFrom, int nCommand)
1492 #define MSG_WM_NOTIFYFORMAT(func) \
1493 if (uMsg == WM_NOTIFYFORMAT) \
1495 SetMsgHandled(TRUE); \
1496 lResult = (LRESULT)func((HWND)wParam, (int)lParam); \
1497 if(IsMsgHandled()) \
1498 return TRUE; \
1501 // BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData)
1502 #define MSG_WM_POWERBROADCAST(func) \
1503 if (uMsg == WM_POWERBROADCAST) \
1505 SetMsgHandled(TRUE); \
1506 lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \
1507 if(IsMsgHandled()) \
1508 return TRUE; \
1511 // void OnPrint(CDCHandle dc, UINT uFlags)
1512 #define MSG_WM_PRINT(func) \
1513 if (uMsg == WM_PRINT) \
1515 SetMsgHandled(TRUE); \
1516 func((HDC)wParam, (UINT)lParam); \
1517 lResult = 0; \
1518 if(IsMsgHandled()) \
1519 return TRUE; \
1522 // void OnPrintClient(CDCHandle dc, UINT uFlags)
1523 #define MSG_WM_PRINTCLIENT(func) \
1524 if (uMsg == WM_PRINTCLIENT) \
1526 SetMsgHandled(TRUE); \
1527 func((HDC)wParam, (UINT)lParam); \
1528 lResult = 0; \
1529 if(IsMsgHandled()) \
1530 return TRUE; \
1533 // void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError)
1534 #define MSG_WM_RASDIALEVENT(func) \
1535 if (uMsg == WM_RASDIALEVENT) \
1537 SetMsgHandled(TRUE); \
1538 func((RASCONNSTATE)wParam, (DWORD)lParam); \
1539 lResult = TRUE; \
1540 if(IsMsgHandled()) \
1541 return TRUE; \
1544 // void OnSetFont(CFont font, BOOL bRedraw)
1545 #define MSG_WM_SETFONT(func) \
1546 if (uMsg == WM_SETFONT) \
1548 SetMsgHandled(TRUE); \
1549 func((HFONT)wParam, (BOOL)LOWORD(lParam)); \
1550 lResult = 0; \
1551 if(IsMsgHandled()) \
1552 return TRUE; \
1555 // int OnSetHotKey(int nVirtKey, UINT uFlags)
1556 #define MSG_WM_SETHOTKEY(func) \
1557 if (uMsg == WM_SETHOTKEY) \
1559 SetMsgHandled(TRUE); \
1560 lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \
1561 if(IsMsgHandled()) \
1562 return TRUE; \
1565 // HICON OnSetIcon(UINT uType, HICON hIcon)
1566 #define MSG_WM_SETICON(func) \
1567 if (uMsg == WM_SETICON) \
1569 SetMsgHandled(TRUE); \
1570 lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \
1571 if(IsMsgHandled()) \
1572 return TRUE; \
1575 // void OnSetRedraw(BOOL bRedraw)
1576 #define MSG_WM_SETREDRAW(func) \
1577 if (uMsg == WM_SETREDRAW) \
1579 SetMsgHandled(TRUE); \
1580 func((BOOL)wParam); \
1581 lResult = 0; \
1582 if(IsMsgHandled()) \
1583 return TRUE; \
1586 // int OnSetText(LPCTSTR lpstrText)
1587 #define MSG_WM_SETTEXT(func) \
1588 if (uMsg == WM_SETTEXT) \
1590 SetMsgHandled(TRUE); \
1591 lResult = (LRESULT)func((LPCTSTR)lParam); \
1592 if(IsMsgHandled()) \
1593 return TRUE; \
1596 // void OnUserChanged()
1597 #define MSG_WM_USERCHANGED(func) \
1598 if (uMsg == WM_USERCHANGED) \
1600 SetMsgHandled(TRUE); \
1601 func(); \
1602 lResult = 0; \
1603 if(IsMsgHandled()) \
1604 return TRUE; \
1607 ///////////////////////////////////////////////////////////////////////////////
1608 // New NT4 & NT5 messages
1610 #if(_WIN32_WINNT >= 0x0400)
1612 // void OnMouseHover(WPARAM wParam, CPoint ptPos)
1613 #define MSG_WM_MOUSEHOVER(func) \
1614 if (uMsg == WM_MOUSEHOVER) \
1616 SetMsgHandled(TRUE); \
1617 func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1618 lResult = 0; \
1619 if(IsMsgHandled()) \
1620 return TRUE; \
1623 // void OnMouseLeave()
1624 #define MSG_WM_MOUSELEAVE(func) \
1625 if (uMsg == WM_MOUSELEAVE) \
1627 SetMsgHandled(TRUE); \
1628 func(); \
1629 lResult = 0; \
1630 if(IsMsgHandled()) \
1631 return TRUE; \
1634 #endif /* _WIN32_WINNT >= 0x0400 */
1636 #if(WINVER >= 0x0500)
1638 // void OnMenuRButtonUp(WPARAM wParam, CMenu menu)
1639 #define MSG_WM_MENURBUTTONUP(func) \
1640 if (uMsg == WM_MENURBUTTONUP) \
1642 SetMsgHandled(TRUE); \
1643 func(wParam, (HMENU)lParam); \
1644 lResult = 0; \
1645 if(IsMsgHandled()) \
1646 return TRUE; \
1649 // LRESULT OnMenuDrag(WPARAM wParam, CMenu menu)
1650 #define MSG_WM_MENUDRAG(func) \
1651 if (uMsg == WM_MENUDRAG) \
1653 SetMsgHandled(TRUE); \
1654 lResult = func(wParam, (HMENU)lParam); \
1655 if(IsMsgHandled()) \
1656 return TRUE; \
1659 // LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info)
1660 #define MSG_WM_MENUGETOBJECT(func) \
1661 if (uMsg == WM_MENUGETOBJECT) \
1663 SetMsgHandled(TRUE); \
1664 lResult = func((PMENUGETOBJECTINFO)lParam); \
1665 if(IsMsgHandled()) \
1666 return TRUE; \
1669 // void OnUnInitMenuPopup(UINT nID, CMenu menu)
1670 #define MSG_WM_UNINITMENUPOPUP(func) \
1671 if (uMsg == WM_UNINITMENUPOPUP) \
1673 SetMsgHandled(TRUE); \
1674 func((UINT)HIWORD(lParam), (HMENU)wParam); \
1675 lResult = 0; \
1676 if(IsMsgHandled()) \
1677 return TRUE; \
1680 // void OnMenuCommand(WPARAM nIndex, CMenu menu)
1681 #define MSG_WM_MENUCOMMAND(func) \
1682 if (uMsg == WM_MENUCOMMAND) \
1684 SetMsgHandled(TRUE); \
1685 func(wParam, (HMENU)lParam); \
1686 lResult = 0; \
1687 if(IsMsgHandled()) \
1688 return TRUE; \
1691 #endif /* WINVER >= 0x0500 */
1693 #if(_WIN32_WINNT >= 0x0500)
1695 // BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys)
1696 #define MSG_WM_APPCOMMAND(func) \
1697 if (uMsg == WM_APPCOMMAND) \
1699 SetMsgHandled(TRUE); \
1700 lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \
1701 if(IsMsgHandled()) \
1702 return TRUE; \
1705 // void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos)
1706 #define MSG_WM_NCXBUTTONDOWN(func) \
1707 if (uMsg == WM_NCXBUTTONDOWN) \
1709 SetMsgHandled(TRUE); \
1710 func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1711 lResult = 0; \
1712 if(IsMsgHandled()) \
1713 return TRUE; \
1716 // void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos)
1717 #define MSG_WM_NCXBUTTONUP(func) \
1718 if (uMsg == WM_NCXBUTTONUP) \
1720 SetMsgHandled(TRUE); \
1721 func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1722 lResult = 0; \
1723 if(IsMsgHandled()) \
1724 return TRUE; \
1727 // void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos)
1728 #define MSG_WM_NCXBUTTONDBLCLK(func) \
1729 if (uMsg == WM_NCXBUTTONDBLCLK) \
1731 SetMsgHandled(TRUE); \
1732 func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1733 lResult = 0; \
1734 if(IsMsgHandled()) \
1735 return TRUE; \
1738 // void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
1739 #define MSG_WM_XBUTTONDOWN(func) \
1740 if (uMsg == WM_XBUTTONDOWN) \
1742 SetMsgHandled(TRUE); \
1743 func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1744 lResult = 0; \
1745 if(IsMsgHandled()) \
1746 return TRUE; \
1749 // void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos)
1750 #define MSG_WM_XBUTTONUP(func) \
1751 if (uMsg == WM_XBUTTONUP) \
1753 SetMsgHandled(TRUE); \
1754 func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1755 lResult = 0; \
1756 if(IsMsgHandled()) \
1757 return TRUE; \
1760 // void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos)
1761 #define MSG_WM_XBUTTONDBLCLK(func) \
1762 if (uMsg == WM_XBUTTONDBLCLK) \
1764 SetMsgHandled(TRUE); \
1765 func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
1766 lResult = 0; \
1767 if(IsMsgHandled()) \
1768 return TRUE; \
1771 // void OnChangeUIState(WORD nAction, WORD nState)
1772 #define MSG_WM_CHANGEUISTATE(func) \
1773 if (uMsg == WM_CHANGEUISTATE) \
1775 SetMsgHandled(TRUE); \
1776 func(LOWORD(wParam), HIWORD(wParam)); \
1777 lResult = 0; \
1778 if(IsMsgHandled()) \
1779 return TRUE; \
1782 // void OnUpdateUIState(WORD nAction, WORD nState)
1783 #define MSG_WM_UPDATEUISTATE(func) \
1784 if (uMsg == WM_UPDATEUISTATE) \
1786 SetMsgHandled(TRUE); \
1787 func(LOWORD(wParam), HIWORD(wParam)); \
1788 lResult = 0; \
1789 if(IsMsgHandled()) \
1790 return TRUE; \
1793 // LRESULT OnQueryUIState()
1794 #define MSG_WM_QUERYUISTATE(func) \
1795 if (uMsg == WM_QUERYUISTATE) \
1797 SetMsgHandled(TRUE); \
1798 lResult = func(); \
1799 if(IsMsgHandled()) \
1800 return TRUE; \
1803 #endif // (_WIN32_WINNT >= 0x0500)
1805 #if(_WIN32_WINNT >= 0x0501)
1807 // void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput)
1808 #define MSG_WM_INPUT(func) \
1809 if (uMsg == WM_INPUT) \
1811 SetMsgHandled(TRUE); \
1812 func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \
1813 lResult = 0; \
1814 if(IsMsgHandled()) \
1815 return TRUE; \
1818 // void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags)
1819 #define MSG_WM_UNICHAR(func) \
1820 if (uMsg == WM_UNICHAR) \
1822 SetMsgHandled(TRUE); \
1823 func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
1824 if(IsMsgHandled()) \
1826 lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \
1827 return TRUE; \
1831 // void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID)
1832 #define MSG_WM_WTSSESSION_CHANGE(func) \
1833 if (uMsg == WM_WTSSESSION_CHANGE) \
1835 SetMsgHandled(TRUE); \
1836 func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \
1837 lResult = 0; \
1838 if(IsMsgHandled()) \
1839 return TRUE; \
1842 // OnThemeChanged()
1843 #define MSG_WM_THEMECHANGED(func) \
1844 if (uMsg == WM_THEMECHANGED) \
1846 SetMsgHandled(TRUE); \
1847 func(); \
1848 lResult = 0; \
1849 if(IsMsgHandled()) \
1850 return TRUE; \
1853 #endif /* _WIN32_WINNT >= 0x0501 */
1855 ///////////////////////////////////////////////////////////////////////////////
1856 // ATL defined messages
1858 // BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData)
1859 #define MSG_WM_FORWARDMSG(func) \
1860 if (uMsg == WM_FORWARDMSG) \
1862 SetMsgHandled(TRUE); \
1863 lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \
1864 if(IsMsgHandled()) \
1865 return TRUE; \
1868 ///////////////////////////////////////////////////////////////////////////////
1869 // Dialog specific messages
1871 // LRESULT OnDMGetDefID()
1872 #define MSG_DM_GETDEFID(func) \
1873 if (uMsg == DM_GETDEFID) \
1875 SetMsgHandled(TRUE); \
1876 lResult = func(); \
1877 if(IsMsgHandled()) \
1878 return TRUE; \
1881 // void OnDMSetDefID(UINT DefID)
1882 #define MSG_DM_SETDEFID(func) \
1883 if (uMsg == DM_SETDEFID) \
1885 SetMsgHandled(TRUE); \
1886 func((UINT)wParam); \
1887 lResult = TRUE; \
1888 if(IsMsgHandled()) \
1889 return TRUE; \
1892 // void OnDMReposition()
1893 #define MSG_DM_REPOSITION(func) \
1894 if (uMsg == DM_REPOSITION) \
1896 SetMsgHandled(TRUE); \
1897 func(); \
1898 lResult = 0; \
1899 if(IsMsgHandled()) \
1900 return TRUE; \
1903 ///////////////////////////////////////////////////////////////////////////////
1904 // Reflected messages
1906 // void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
1907 #define MSG_OCM_COMMAND(func) \
1908 if (uMsg == OCM_COMMAND) \
1910 SetMsgHandled(TRUE); \
1911 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
1912 lResult = 0; \
1913 if(IsMsgHandled()) \
1914 return TRUE; \
1917 // LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh)
1918 #define MSG_OCM_NOTIFY(func) \
1919 if (uMsg == OCM_NOTIFY) \
1921 SetMsgHandled(TRUE); \
1922 lResult = func((int)wParam, (LPNMHDR)lParam); \
1923 if(IsMsgHandled()) \
1924 return TRUE; \
1927 // void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam)
1928 #define MSG_OCM_PARENTNOTIFY(func) \
1929 if (uMsg == OCM_PARENTNOTIFY) \
1931 SetMsgHandled(TRUE); \
1932 func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
1933 lResult = 0; \
1934 if(IsMsgHandled()) \
1935 return TRUE; \
1938 // void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
1939 #define MSG_OCM_DRAWITEM(func) \
1940 if (uMsg == OCM_DRAWITEM) \
1942 SetMsgHandled(TRUE); \
1943 func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
1944 lResult = TRUE; \
1945 if(IsMsgHandled()) \
1946 return TRUE; \
1949 // void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
1950 #define MSG_OCM_MEASUREITEM(func) \
1951 if (uMsg == OCM_MEASUREITEM) \
1953 SetMsgHandled(TRUE); \
1954 func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
1955 lResult = TRUE; \
1956 if(IsMsgHandled()) \
1957 return TRUE; \
1960 // int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
1961 #define MSG_OCM_COMPAREITEM(func) \
1962 if (uMsg == OCM_COMPAREITEM) \
1964 SetMsgHandled(TRUE); \
1965 lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
1966 if(IsMsgHandled()) \
1967 return TRUE; \
1970 // void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
1971 #define MSG_OCM_DELETEITEM(func) \
1972 if (uMsg == OCM_DELETEITEM) \
1974 SetMsgHandled(TRUE); \
1975 func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
1976 lResult = TRUE; \
1977 if(IsMsgHandled()) \
1978 return TRUE; \
1981 // int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
1982 #define MSG_OCM_VKEYTOITEM(func) \
1983 if (uMsg == OCM_VKEYTOITEM) \
1985 SetMsgHandled(TRUE); \
1986 lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
1987 if(IsMsgHandled()) \
1988 return TRUE; \
1991 //int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
1992 #define MSG_OCM_CHARTOITEM(func) \
1993 if (uMsg == OCM_CHARTOITEM) \
1995 SetMsgHandled(TRUE); \
1996 lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
1997 if(IsMsgHandled()) \
1998 return TRUE; \
2001 // void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
2002 #define MSG_OCM_HSCROLL(func) \
2003 if (uMsg == OCM_HSCROLL) \
2005 SetMsgHandled(TRUE); \
2006 func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
2007 lResult = 0; \
2008 if(IsMsgHandled()) \
2009 return TRUE; \
2012 // void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
2013 #define MSG_OCM_VSCROLL(func) \
2014 if (uMsg == OCM_VSCROLL) \
2016 SetMsgHandled(TRUE); \
2017 func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
2018 lResult = 0; \
2019 if(IsMsgHandled()) \
2020 return TRUE; \
2023 // HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit)
2024 #define MSG_OCM_CTLCOLOREDIT(func) \
2025 if (uMsg == OCM_CTLCOLOREDIT) \
2027 SetMsgHandled(TRUE); \
2028 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2029 if(IsMsgHandled()) \
2030 return TRUE; \
2033 // HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox)
2034 #define MSG_OCM_CTLCOLORLISTBOX(func) \
2035 if (uMsg == OCM_CTLCOLORLISTBOX) \
2037 SetMsgHandled(TRUE); \
2038 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2039 if(IsMsgHandled()) \
2040 return TRUE; \
2043 // HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button)
2044 #define MSG_OCM_CTLCOLORBTN(func) \
2045 if (uMsg == OCM_CTLCOLORBTN) \
2047 SetMsgHandled(TRUE); \
2048 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2049 if(IsMsgHandled()) \
2050 return TRUE; \
2053 // HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd)
2054 #define MSG_OCM_CTLCOLORDLG(func) \
2055 if (uMsg == OCM_CTLCOLORDLG) \
2057 SetMsgHandled(TRUE); \
2058 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2059 if(IsMsgHandled()) \
2060 return TRUE; \
2063 // HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
2064 #define MSG_OCM_CTLCOLORSCROLLBAR(func) \
2065 if (uMsg == OCM_CTLCOLORSCROLLBAR) \
2067 SetMsgHandled(TRUE); \
2068 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2069 if(IsMsgHandled()) \
2070 return TRUE; \
2073 // HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic)
2074 #define MSG_OCM_CTLCOLORSTATIC(func) \
2075 if (uMsg == OCM_CTLCOLORSTATIC) \
2077 SetMsgHandled(TRUE); \
2078 lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
2079 if(IsMsgHandled()) \
2080 return TRUE; \
2083 ///////////////////////////////////////////////////////////////////////////////
2084 // Edit specific messages
2086 // void OnClear()
2087 #define MSG_WM_CLEAR(func) \
2088 if (uMsg == WM_CLEAR) \
2090 SetMsgHandled(TRUE); \
2091 func(); \
2092 lResult = 0; \
2093 if(IsMsgHandled()) \
2094 return TRUE; \
2097 // void OnCopy()
2098 #define MSG_WM_COPY(func) \
2099 if (uMsg == WM_COPY) \
2101 SetMsgHandled(TRUE); \
2102 func(); \
2103 lResult = 0; \
2104 if(IsMsgHandled()) \
2105 return TRUE; \
2108 // void OnCut()
2109 #define MSG_WM_CUT(func) \
2110 if (uMsg == WM_CUT) \
2112 SetMsgHandled(TRUE); \
2113 func(); \
2114 lResult = 0; \
2115 if(IsMsgHandled()) \
2116 return TRUE; \
2119 // void OnPaste()
2120 #define MSG_WM_PASTE(func) \
2121 if (uMsg == WM_PASTE) \
2123 SetMsgHandled(TRUE); \
2124 func(); \
2125 lResult = 0; \
2126 if(IsMsgHandled()) \
2127 return TRUE; \
2130 // void OnUndo()
2131 #define MSG_WM_UNDO(func) \
2132 if (uMsg == WM_UNDO) \
2134 SetMsgHandled(TRUE); \
2135 func(); \
2136 lResult = 0; \
2137 if(IsMsgHandled()) \
2138 return TRUE; \
2141 ///////////////////////////////////////////////////////////////////////////////
2142 // Generic message handlers
2144 // LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
2145 #define MESSAGE_HANDLER_EX(msg, func) \
2146 if(uMsg == msg) \
2148 SetMsgHandled(TRUE); \
2149 lResult = func(uMsg, wParam, lParam); \
2150 if(IsMsgHandled()) \
2151 return TRUE; \
2154 // LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
2155 #define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \
2156 if(uMsg >= msgFirst && uMsg <= msgLast) \
2158 SetMsgHandled(TRUE); \
2159 lResult = func(uMsg, wParam, lParam); \
2160 if(IsMsgHandled()) \
2161 return TRUE; \
2164 ///////////////////////////////////////////////////////////////////////////////
2165 // Commands and notifications
2167 // void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2168 #define COMMAND_HANDLER_EX(id, code, func) \
2169 if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
2171 SetMsgHandled(TRUE); \
2172 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2173 lResult = 0; \
2174 if(IsMsgHandled()) \
2175 return TRUE; \
2178 // void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2179 #define COMMAND_ID_HANDLER_EX(id, func) \
2180 if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
2182 SetMsgHandled(TRUE); \
2183 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2184 lResult = 0; \
2185 if(IsMsgHandled()) \
2186 return TRUE; \
2189 // void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2190 #define COMMAND_CODE_HANDLER_EX(code, func) \
2191 if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
2193 SetMsgHandled(TRUE); \
2194 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2195 lResult = 0; \
2196 if(IsMsgHandled()) \
2197 return TRUE; \
2200 // LRESULT OnNotifyHandlerEX(LPNMHDR pnmh)
2201 #define NOTIFY_HANDLER_EX(id, cd, func) \
2202 if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
2204 SetMsgHandled(TRUE); \
2205 lResult = func((LPNMHDR)lParam); \
2206 if(IsMsgHandled()) \
2207 return TRUE; \
2210 // LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh)
2211 #define NOTIFY_ID_HANDLER_EX(id, func) \
2212 if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
2214 SetMsgHandled(TRUE); \
2215 lResult = func((LPNMHDR)lParam); \
2216 if(IsMsgHandled()) \
2217 return TRUE; \
2220 // LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh)
2221 #define NOTIFY_CODE_HANDLER_EX(cd, func) \
2222 if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
2224 SetMsgHandled(TRUE); \
2225 lResult = func((LPNMHDR)lParam); \
2226 if(IsMsgHandled()) \
2227 return TRUE; \
2230 // void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2231 #define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
2232 if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
2234 SetMsgHandled(TRUE); \
2235 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2236 lResult = 0; \
2237 if(IsMsgHandled()) \
2238 return TRUE; \
2241 // void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2242 #define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
2243 if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
2245 SetMsgHandled(TRUE); \
2246 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2247 lResult = 0; \
2248 if(IsMsgHandled()) \
2249 return TRUE; \
2252 // LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh)
2253 #define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
2254 if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
2256 SetMsgHandled(TRUE); \
2257 lResult = func((LPNMHDR)lParam); \
2258 if(IsMsgHandled()) \
2259 return TRUE; \
2262 // LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
2263 #define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
2264 if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
2266 SetMsgHandled(TRUE); \
2267 lResult = func((LPNMHDR)lParam); \
2268 if(IsMsgHandled()) \
2269 return TRUE; \
2272 // LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2273 #define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \
2274 if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
2276 SetMsgHandled(TRUE); \
2277 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2278 lResult = 0; \
2279 if(IsMsgHandled()) \
2280 return TRUE; \
2283 // LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2284 #define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \
2285 if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
2287 SetMsgHandled(TRUE); \
2288 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2289 lResult = 0; \
2290 if(IsMsgHandled()) \
2291 return TRUE; \
2294 // LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2295 #define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \
2296 if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
2298 SetMsgHandled(TRUE); \
2299 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2300 lResult = 0; \
2301 if(IsMsgHandled()) \
2302 return TRUE; \
2305 // LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh)
2306 #define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \
2307 if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
2309 SetMsgHandled(TRUE); \
2310 lResult = func((LPNMHDR)lParam); \
2311 if(IsMsgHandled()) \
2312 return TRUE; \
2315 // LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh)
2316 #define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \
2317 if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
2319 SetMsgHandled(TRUE); \
2320 lResult = func((LPNMHDR)lParam); \
2321 if(IsMsgHandled()) \
2322 return TRUE; \
2325 // LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh)
2326 #define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \
2327 if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
2329 SetMsgHandled(TRUE); \
2330 lResult = func((LPNMHDR)lParam); \
2331 if(IsMsgHandled()) \
2332 return TRUE; \
2335 // void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2336 #define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
2337 if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
2339 SetMsgHandled(TRUE); \
2340 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2341 lResult = 0; \
2342 if(IsMsgHandled()) \
2343 return TRUE; \
2346 // void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
2347 #define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
2348 if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
2350 SetMsgHandled(TRUE); \
2351 func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
2352 lResult = 0; \
2353 if(IsMsgHandled()) \
2354 return TRUE; \
2357 // LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh)
2358 #define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
2359 if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
2361 SetMsgHandled(TRUE); \
2362 lResult = func((LPNMHDR)lParam); \
2363 if(IsMsgHandled()) \
2364 return TRUE; \
2367 // LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
2368 #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
2369 if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
2371 SetMsgHandled(TRUE); \
2372 lResult = func((LPNMHDR)lParam); \
2373 if(IsMsgHandled()) \
2374 return TRUE; \
2377 #endif // __ATLCRACK_H__