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