comparison foosdk/wtl/Include/atlcrack.h @ 1:20d02a178406 default tip

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