-
Notifications
You must be signed in to change notification settings - Fork 11
/
SubclassWnd.h
898 lines (710 loc) · 33.6 KB
/
SubclassWnd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
/** @file SubclassWnd.h
*
* Definition of CSubclassWnd.h.
*
* @author William E. Kempf
* @version 2.0
*
* Copyright © 2000 NEWare Software.
*
* This code may be used in compiled form in any way you desire (including
* commercial use). The code may be redistributed unmodified by any means providing
* it is not sold for profit without the authors written consent, and providing that
* this notice and the authors name and all copyright notices remains intact. However,
* this file and the accompanying source code may not be hosted on a website or bulletin
* board without the authors written permission.
*
* <b><i>This software is provided "as is" without express or implied warranty. Use it
* at your own risk!</i></b>
*/
#if !defined(_SUBCLASSWND_H_199B246E_AE5D_11D3_A459_000629B2F85_INCLUDED_)
#define _SUBCLASSWND_H_199B246E_AE5D_11D3_A459_000629B2F85_INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/**
* Pluggable window message handler.
*
* This class can be used to "subclass" a window in the C API sense of the term.
* It is a base class, meant to be derived from. Derived classes should provide
* an interface that will call CSubclassWnd::SubclassWindow in order to hook into
* a window's message handling interface. Typically this will be done in the
* derived's constructor and the OnFinalMessage method will be overriden to delete
* the object's instance (delete this).
*/
class CSubclassWnd
{
private:
class WndProcThunk
{
public:
#if defined(_M_IX86)
#pragma pack(push,1)
struct Thunk
{
DWORD m_mov; // mov dword ptr [esp+0x4], pThis (esp+0x4 is hWnd)
DWORD m_this; //
BYTE m_jmp; // jmp WndProc
DWORD m_relproc; // relative jmp
};
#pragma pack(pop)
#elif defined (_M_ALPHA)
// For ALPHA we will stick the this pointer into a0, which is where
// the HWND is. However, we don't actually need the HWND so this is OK.
#pragma pack(push,4)
struct Thunk //this should come out to 20 bytes
{
DWORD ldah_at; // ldah at, HIWORD(func)
DWORD ldah_a0; // ldah a0, HIWORD(this)
DWORD lda_at; // lda at, LOWORD(func)(at)
DWORD lda_a0; // lda a0, LOWORD(this)(a0)
DWORD jmp; // jmp zero,(at),0
};
#pragma pack(pop)
#else
#error Only Alpha and X86 supported
#endif
Thunk thunk;
void Init(WNDPROC proc, void* pThis)
{
#if defined (_M_IX86)
thunk.m_mov = 0x042444C7; //C7 44 24 0C
thunk.m_this = (DWORD)pThis;
thunk.m_jmp = 0xe9;
thunk.m_relproc = (int)proc - ((int)this+sizeof(Thunk));
#elif defined (_M_ALPHA)
thunk.ldah_at = (0x279f0000 | HIWORD(proc)) + (LOWORD(proc)>>15);
thunk.ldah_a0 = (0x261f0000 | HIWORD(pThis)) + (LOWORD(pThis)>>15);
thunk.lda_at = 0x239c0000 | LOWORD(proc);
thunk.lda_a0 = 0x22100000 | LOWORD(pThis);
thunk.jmp = 0x6bfc0000;
#endif
// write block from data cache and
// flush from instruction cache
FlushInstructionCache(GetCurrentProcess(), &thunk, sizeof(thunk));
}
};
protected:
CSubclassWnd();
virtual ~CSubclassWnd();
virtual BOOL ProcessWindowMessage(UINT message, WPARAM wParam, LPARAM lParam,
LRESULT& lResult);
virtual void OnFinalMessage();
LRESULT DefWindowProc();
LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
#ifdef _MFC_VER
BOOL SubclassWindow(CWnd* pWnd, BOOL bReflect=TRUE);
#endif
BOOL SubclassWindow(HWND hWnd, BOOL bReflect=TRUE);
HWND UnsubclassWindow();
public:
const MSG* GetCurrentMessage() const;
HWND GetHandle() const;
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0);
BOOL PostMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0);
void SendMessageToDescendants(UINT message, WPARAM wParam, LPARAM lParam,
BOOL bDeep=TRUE);
private:
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam);
private:
WndProcThunk m_thunk;
WNDPROC m_pfnSuperWindowProc;
const MSG* m_pCurrentMsg;
HWND m_hWnd;
};
#ifdef _MFC_VER
/**
* Called to subclass the specified window. If the @a bReflect
* parameter is TRUE then the parent window will be subclassed to
* support message reflection.
*
* @param pWnd [in] Points to the CWnd to be subclassed.
* @param bReflect [in] Specifies whether or not the parent should
* reflect messages back to the window.
*
* @return TRUE if successful; otherwise FALSE.
*/
inline BOOL CSubclassWnd::SubclassWindow(CWnd* pWnd, BOOL bReflect)
{
return SubclassWindow(pWnd->GetSafeHwnd(), bReflect);
}
#endif
/**
* Retrieves a pointer to the "current" MSG structure being handled.
*
* @return Returns a pointer to the "current" MSG structure being handled.
*/
inline const MSG* CSubclassWnd::GetCurrentMessage() const
{
return m_pCurrentMsg;
}
/**
* Calls the "default" window procedure with the current message. The
* "default" procedure is what ever procedure was subclassed by this
* class.
*
* @return The return value is the result of the message processing and
* depends on the message.
*/
inline LRESULT CSubclassWnd::DefWindowProc()
{
const MSG* pMsg = m_pCurrentMsg;
LRESULT lRes = 0;
if (pMsg != NULL)
lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
return lRes;
}
/**
* Calls the "default" window procedure with the specified message. The
* "default" procedure is what ever procedure was subclassed by this
* class.
*
* @param message [in] Specifies the message id.
* @param wParam [in] Specifies additional message-specific information.
* @param lParam [in] Specifies additional message-specific information.
*
* @return The return value is the result of the message processing and
* depends on the message.
*/
inline LRESULT CSubclassWnd::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef STRICT
return ::CallWindowProc(m_pfnSuperWindowProc, m_hWnd, message, wParam, lParam);
#else
return ::CallWindowProc((FARPROC)m_pfnSuperWindowProc, m_hWnd, message, wParam, lParam);
#endif
}
/**
* Called to get the handle of the subclassed window.
*
* @return The handle to the currently subclassed window.
*/
inline HWND CSubclassWnd::GetHandle() const
{
return m_hWnd;
}
/**
* Sends a message to the subclassed window.
*
* @param message [in] Specifies the message id.
* @param wParam [in] Specifies additional message-specific information.
* @param lParam [in] Specifies additional message-specific information.
*
* @return The return value is the result of the message processing and
* depends on the message.
*/
inline LRESULT CSubclassWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
return ::SendMessage(GetHandle(), message, wParam, lParam);
}
/**
* Posts a message to the subclassed window.
*
* @param message [in] Specifies the message id.
* @param wParam [in] Specifies additional message-specific information.
* @param lParam [in] Specifies additional message-specific information.
*
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
inline BOOL CSubclassWnd::PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
return ::PostMessage(GetHandle(), message, wParam, lParam);
}
template <typename T>
struct DISPATCH_TRAITS
{
typedef T type;
};
/** @def BEGIN_MSG_DISPATCH(className, rootClass)
*
* Begins the message dispatch map.
*/
#define BEGIN_MSG_DISPATCH(className, rootClass) \
virtual BOOL ProcessWindowMessage(UINT message, WPARAM wParam, \
LPARAM lParam, LRESULT& lResult) { \
typedef DISPATCH_TRAITS<##rootClass>::type root_type; \
if (FALSE) ;
/**
* Ends the message dispatch map.
*/
#define END_MSG_DISPATCH() \
return root_type::ProcessWindowMessage(message, wParam, lParam, lResult); }
/**
* Dispatches a message to a member function from within the message map. If you
* want to dispatch a user define message you must declare a dispatch macro
* for it. See the header file <b>SubclassWnd.h</b> for examples of how to declare
* such macros.
*/
#define DISPATCH_MSG(msg, mfn) \
else if (message == msg) { lResult = DISPATCH_##msg((wParam), (lParam), (mfn)); return TRUE; }
/* void Class::OnCompacting(UINT compactRatio) */
#define DISPATCH_WM_COMPACTING(wParam, lParam, fn) \
((fn)((UINT)(wParam)), 0L)
/* void Class::OnWinIniChange(LPCTSTR lpszSectionName) */
#define DISPATCH_WM_WININICHANGE(wParam, lParam, fn) \
((fn)((LPCTSTR)(lParam)), 0L)
/* void Class::OnSysColorChange() */
#define DISPATCH_WM_SYSCOLORCHANGE(wParam, lParam, fn) \
((fn)(), 0L)
/* BOOL Class::OnQueryNewPalette() */
#define DISPATCH_WM_QUERYNEWPALETTE(wParam, lParam, fn) \
MAKELRESULT((BOOL)(fn)(), 0L)
/* void Class::OnPaletteIsChanging(HWND hwndPaletteChange) */
#define DISPATCH_WM_PALETTEISCHANGING(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* void Class::OnPaletteChanged(HWND hwndPaletteChange) */
#define DISPATCH_WM_PALETTECHANGED(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* void Class::OnFontChange() */
#define DISPATCH_WM_FONTCHANGE(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnSpoolerStatus(UINT status, int cJobInQueue) */
#define DISPATCH_WM_SPOOLERSTATUS(wParam, lParam, fn) \
((fn)((UINT)(wParam), (int)(short)LOWORD(lParam)), 0L)
/* void Class::OnDevModeChange(LPCTSTR lpszDeviceName) */
#define DISPATCH_WM_DEVMODECHANGE(wParam, lParam, fn) \
((fn)((LPCTSTR)(lParam)), 0L)
/* void Class::OnTimeChange() */
#define DISPATCH_WM_TIMECHANGE(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnPower(int code) */
#define DISPATCH_WM_POWER(wParam, lParam, fn) \
((fn)((int)(wParam)), 0L)
/* BOOL Class::OnQueryEndSession() */
#define DISPATCH_WM_QUERYENDSESSION(wParam, lParam, fn) \
MAKELRESULT((BOOL)(fn)(), 0L)
/* void Class::OnEndSession(BOOL fEnding) */
#define DISPATCH_WM_ENDSESSION(wParam, lParam, fn) \
((fn)((BOOL)(wParam)), 0L)
/* void Class::OnQuit(int exitCode) */
#define DISPATCH_WM_QUIT(wParam, lParam, fn) \
((fn)((int)(wParam)), 0L)
/* This message is in Windows 3.1 only */
/* void Class::OnSystemError(int errCode) */
#define DISPATCH_WM_SYSTEMERROR(wParam, lParam, fn) 0L
/* BOOL Class::OnCreate(LPCREATESTRUCT lpCreateStruct) */
#define DISPATCH_WM_CREATE(wParam, lParam, fn) \
((fn)((LPCREATESTRUCT)(lParam)) ? 0L : (LRESULT)-1L)
/* BOOL Class::OnNCCreate(LPCREATESTRUCT lpCreateStruct) */
#define DISPATCH_WM_NCCREATE(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((LPCREATESTRUCT)(lParam))
/* void Class::OnDestroy() */
#define DISPATCH_WM_DESTROY(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnNCDestroy() */
#define DISPATCH_WM_NCDESTROY(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnShowWindow(BOOL fShow, UINT status) */
#define DISPATCH_WM_SHOWWINDOW(wParam, lParam, fn) \
((fn)((BOOL)(wParam), (UINT)(lParam)), 0L)
/* void Class::OnSetRedraw(BOOL fRedraw) */
#define DISPATCH_WM_SETREDRAW(wParam, lParam, fn) \
((fn)((BOOL)(wParam)), 0L)
/* void Class::OnEnable(BOOL fEnable) */
#define DISPATCH_WM_ENABLE(wParam, lParam, fn) \
((fn)((BOOL)(wParam)), 0L)
/* void Class::OnSetText(LPCTSTR lpszText) */
#define DISPATCH_WM_SETTEXT(wParam, lParam, fn) \
((fn)((LPCTSTR)(lParam)), 0L)
/* int Class::OnGetText(int cchTextMax, LPTSTR lpszText) */
#define DISPATCH_WM_GETTEXT(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((int)(wParam), (LPTSTR)(lParam))
/* int Class::OnGetTextLength() */
#define DISPATCH_WM_GETTEXTLENGTH(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)()
/* BOOL Class::OnWindowPosChanging(LPWINDOWPOS lpwpos) */
#define DISPATCH_WM_WINDOWPOSCHANGING(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((LPWINDOWPOS)(lParam))
/* void Class::OnWindowPosChanged(const LPWINDOWPOS lpwpos) */
#define DISPATCH_WM_WINDOWPOSCHANGED(wParam, lParam, fn) \
((fn)((const LPWINDOWPOS)(lParam)), 0L)
/* void Class::OnMove(int x, int y) */
#define DISPATCH_WM_MOVE(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
/* void Class::OnSize(UINT state, int cx, int cy) */
#define DISPATCH_WM_SIZE(wParam, lParam, fn) \
((fn)((UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
/* void Class::OnClose() */
#define DISPATCH_WM_CLOSE(wParam, lParam, fn) \
((fn)(), 0L)
/* BOOL Class::OnQueryOpen() */
#define DISPATCH_WM_QUERYOPEN(wParam, lParam, fn) \
MAKELRESULT((BOOL)(fn)(), 0L)
/* void Class::OnGetMinMaxInfo(LPMINMAXINFO lpMinMaxInfo) */
#define DISPATCH_WM_GETMINMAXINFO(wParam, lParam, fn) \
((fn)((LPMINMAXINFO)(lParam)), 0L)
/* void Class::OnPaint() */
#define DISPATCH_WM_PAINT(wParam, lParam, fn) \
((fn)(), 0L)
/* BOOL Class::OnEraseBkgnd(HDC hdc) */
#define DISPATCH_WM_ERASEBKGND(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((HDC)(wParam))
/* BOOL Class::OnIconEraseBkgnd(HDC hdc) */
#define DISPATCH_WM_ICONERASEBKGND(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((HDC)(wParam))
/* void Class::OnNCPaint(HRGN hrgn) */
#define DISPATCH_WM_NCPAINT(wParam, lParam, fn) \
((fn)((HRGN)(wParam)), 0L)
/* UINT Class::OnNCCalcSize(BOOL fCalcValidRects, NCCALCSIZE_PARAMS * lpcsp) */
#define DISPATCH_WM_NCCALCSIZE(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)((BOOL)(0), (NCCALCSIZE_PARAMS *)(lParam))
/* UINT Class::OnNCHitTest(int x, int y) */
#define DISPATCH_WM_NCHITTEST(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam))
/* HICON Class::OnQueryDragIcon() */
#define DISPATCH_WM_QUERYDRAGICON(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)()
#ifdef _INC_SHELLAPI
/* void Class::OnDropFiles(HDROP hdrop) */
#define DISPATCH_WM_DROPFILES(wParam, lParam, fn) \
((fn)((HDROP)(wParam)), 0L)
#endif /* _INC_SHELLAPI */
/* void Class::OnActivate(UINT state, HWND hwndActDeact, BOOL fMinimized) */
#define DISPATCH_WM_ACTIVATE(wParam, lParam, fn) \
((fn)((UINT)LOWORD(wParam), (HWND)(lParam), (BOOL)HIWORD(wParam)), 0L)
/* void Class::OnActivateApp(BOOL fActivate, DWORD dwThreadId) */
#define DISPATCH_WM_ACTIVATEAPP(wParam, lParam, fn) \
((fn)((BOOL)(wParam), (DWORD)(lParam)), 0L)
/* BOOL Class::OnNCActivate(BOOL fActive, HWND hwndActDeact, BOOL fMinimized) */
#define DISPATCH_WM_NCACTIVATE(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((BOOL)(wParam), 0L, 0L)
/* void Class::OnSetFocus(HWND hwndOldFocus) */
#define DISPATCH_WM_SETFOCUS(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* void Class::OnKillFocus(HWND hwndNewFocus) */
#define DISPATCH_WM_KILLFOCUS(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* void Class::OnKey(UINT vk, BOOL fDown, int cRepeat, UINT flags) */
#define DISPATCH_WM_KEYDOWN(wParam, lParam, fn) \
((fn)((UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
/* void Class::OnKey(UINT vk, BOOL fDown, int cRepeat, UINT flags) */
#define DISPATCH_WM_KEYUP(wParam, lParam, fn) \
((fn)((UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
/* void Class::OnChar(TCHAR ch, int cRepeat) */
#define DISPATCH_WM_CHAR(wParam, lParam, fn) \
((fn)((TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
/* void Class::OnDeadChar(TCHAR ch, int cRepeat) */
#define DISPATCH_WM_DEADCHAR(wParam, lParam, fn) \
((fn)((TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
/* void Class::OnSysKey(UINT vk, BOOL fDown, int cRepeat, UINT flags) */
#define DISPATCH_WM_SYSKEYDOWN(wParam, lParam, fn) \
((fn)((UINT)(wParam), TRUE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
/* void Class::OnSysKey(UINT vk, BOOL fDown, int cRepeat, UINT flags) */
#define DISPATCH_WM_SYSKEYUP(wParam, lParam, fn) \
((fn)((UINT)(wParam), FALSE, (int)(short)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
/* void Class::OnSysChar(TCHAR ch, int cRepeat) */
#define DISPATCH_WM_SYSCHAR(wParam, lParam, fn) \
((fn)((TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
/* void Class::OnSysDeadChar(TCHAR ch, int cRepeat) */
#define DISPATCH_WM_SYSDEADCHAR(wParam, lParam, fn) \
((fn)((TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L)
/* void Class::OnMouseMove(int x, int y, UINT keyFlags) */
#define DISPATCH_WM_MOUSEMOVE(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnLButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_LBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnLButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_LBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnLButtonUp(int x, int y, UINT keyFlags) */
#define DISPATCH_WM_LBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnRButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_RBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnRButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_RBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnRButtonUp(int x, int y, UINT flags) */
#define DISPATCH_WM_RBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnMButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_MBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnMButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags) */
#define DISPATCH_WM_MBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnMButtonUp(int x, int y, UINT flags) */
#define DISPATCH_WM_MBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCMouseMove(int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCMOUSEMOVE(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCLButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCLBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCLButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCLBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCLButtonUp(int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCLBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCRButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCRBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCRButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCRBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCRButtonUp(int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCRBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCMButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCMBUTTONDOWN(wParam, lParam, fn) \
((fn)(FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCMButtonDown(BOOL fDoubleClick, int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCMBUTTONDBLCLK(wParam, lParam, fn) \
((fn)(TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* void Class::OnNCMButtonUp(int x, int y, UINT codeHitTest) */
#define DISPATCH_WM_NCMBUTTONUP(wParam, lParam, fn) \
((fn)((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
/* int Class::OnMouseActivate(HWND hwndTopLevel, UINT codeHitTest, UINT msg) */
#define DISPATCH_WM_MOUSEACTIVATE(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
/* void Class::OnCancelMode() */
#define DISPATCH_WM_CANCELMODE(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnTimer(UINT id) */
#define DISPATCH_WM_TIMER(wParam, lParam, fn) \
((fn)((UINT)(wParam)), 0L)
/* void Class::OnInitMenu(HMENU hMenu) */
#define DISPATCH_WM_INITMENU(wParam, lParam, fn) \
((fn)((HMENU)(wParam)), 0L)
/* void Class::OnInitMenuPopup(HMENU hMenu, UINT item, BOOL fSystemMenu) */
#define DISPATCH_WM_INITMENUPOPUP(wParam, lParam, fn) \
((fn)((HMENU)(wParam), (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)), 0L)
/* void Class::OnMenuSelect(HMENU hmenu, int item, HMENU hmenuPopup, UINT flags) */
#define DISPATCH_WM_MENUSELECT(wParam, lParam, fn) \
((fn)((HMENU)(lParam), \
(HIWORD(wParam) & MF_POPUP) ? 0L : (int)(LOWORD(wParam)), \
(HIWORD(wParam) & MF_POPUP) ? GetSubMenu((HMENU)lParam, LOWORD(wParam)) : 0L, \
(UINT)(((short)HIWORD(wParam) == -1) ? 0xFFFFFFFF : HIWORD(wParam))), 0L)
/* DWORD Class::OnMenuChar(UINT ch, UINT flags, HMENU hmenu) */
#define DISPATCH_WM_MENUCHAR(wParam, lParam, fn) \
(LRESULT)(DWORD)(fn)((UINT)(LOWORD(wParam)), (UINT)HIWORD(wParam), (HMENU)(lParam))
/* void Class::OnCommand(int id, HWND hwndCtl, UINT codeNotify) */
#define DISPATCH_WM_COMMAND(wParam, lParam, fn) \
((fn)((int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
/* void Class::OnCommandReflect(UINT codeNotify) */
#define DISPATCH_OCM_COMMAND(wParam, lParam, fn) \
((fn)((int)((UINT)HIWORD(wParam)), 0L)
/* LRESULT Class::OnNotify(int id, LPNMHDR pnmh) */
#define DISPATCH_WM_NOTIFY(wParam, lParam, fn) \
((fn)((int)wParam, (LPNMHDR)lParam))
/* LRESULT Class::OnNotifyReflect(LPNMHDR pnmh) */
#define DISPATCH_OCM_NOTIFY(wParam, lParam, fn) \
((fn)((LPNMHDR)lParam))
/* void Class::OnHScroll(HWND hwndCtl, UINT code, int pos) */
#define DISPATCH_WM_HSCROLL(wParam, lParam, fn) \
((fn)((HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
/* void Class::OnHScrollReflect(UINT code, int pos) */
#define DISPATCH_OCM_HSCROLL(wParam, lParam, fn) \
((fn)((UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
/* void Class::OnVScroll(HWND hwndCtl, UINT code, int pos) */
#define DISPATCH_WM_VSCROLL(wParam, lParam, fn) \
((fn)((HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
/* void Class::OnVScrollReflect(UINT code, int pos) */
#define DISPATCH_OCM_VSCROLL(wParam, lParam, fn) \
((fn)((UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L)
/* void Class::OnCut() */
#define DISPATCH_WM_CUT(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnCopy() */
#define DISPATCH_WM_COPY(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnPaste() */
#define DISPATCH_WM_PASTE(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnClear() */
#define DISPATCH_WM_CLEAR(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnUndo() */
#define DISPATCH_WM_UNDO(wParam, lParam, fn) \
((fn)(), 0L)
/* HANDLE Class::OnRenderFormat(UINT fmt) */
#define DISPATCH_WM_RENDERFORMAT(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HANDLE)(fn)((UINT)(wParam))
/* void Class::OnRenderAllFormats() */
#define DISPATCH_WM_RENDERALLFORMATS(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnDestroyClipboard() */
#define DISPATCH_WM_DESTROYCLIPBOARD(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnDrawClipboard() */
#define DISPATCH_WM_DRAWCLIPBOARD(wParam, lParam, fn) \
((fn)(), 0L)
/* void Class::OnPaintClipboard(HWND hwndCBViewer, const LPPAINTSTRUCT lpPaintStruct) */
#define DISPATCH_WM_PAINTCLIPBOARD(wParam, lParam, fn) \
((fn)((HWND)(wParam), (const LPPAINTSTRUCT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
/* void Class::OnSizeClipboard(HWND hwndCBViewer, const LPRECT lprc) */
#define DISPATCH_WM_SIZECLIPBOARD(wParam, lParam, fn) \
((fn)((HWND)(wParam), (const LPRECT)GlobalLock((HGLOBAL)(lParam))), GlobalUnlock((HGLOBAL)(lParam)), 0L)
/* void Class::OnVScrollClipboard(HWND hwndCBViewer, UINT code, int pos) */
#define DISPATCH_WM_VSCROLLCLIPBOARD(wParam, lParam, fn) \
((fn)((HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
/* void Class::OnHScrollClipboard(HWND hwndCBViewer, UINT code, int pos) */
#define DISPATCH_WM_HSCROLLCLIPBOARD(wParam, lParam, fn) \
((fn)((HWND)(wParam), (UINT)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
/* void Class::OnAskCBFormatName(int cchMax, LPTSTR rgchName) */
#define DISPATCH_WM_ASKCBFORMATNAME(wParam, lParam, fn) \
((fn)((int)(wParam), (LPTSTR)(lParam)), 0L)
/* void Class::OnChangeCBChain(HWND hwndRemove, HWND hwndNext) */
#define DISPATCH_WM_CHANGECBCHAIN(wParam, lParam, fn) \
((fn)((HWND)(wParam), (HWND)(lParam)), 0L)
/* BOOL Class::OnSetCursor(HWND hwndCursor, UINT codeHitTest, UINT msg) */
#define DISPATCH_WM_SETCURSOR(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam))
/* void Class::OnSysCommand(UINT cmd, int x, int y) */
#define DISPATCH_WM_SYSCOMMAND(wParam, lParam, fn) \
((fn)((UINT)(wParam), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)), 0L)
/* HWND Class::MDICreate(const LPMDICREATESTRUCT lpmcs) */
#define DISPATCH_WM_MDICREATE(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)((LPMDICREATESTRUCT)(lParam))
/* void Class::MDIDestroy(HWND hwndDestroy) */
#define DISPATCH_WM_MDIDESTROY(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* NOTE: Usable only by MDI client windows */
/* void Class::MDIActivate(BOOL fActive, HWND hwndActivate, HWND hwndDeactivate) */
#define DISPATCH_WM_MDIACTIVATE(wParam, lParam, fn) \
((fn)((BOOL)(lParam == (LPARAM)GetHandle()), (HWND)(lParam), (HWND)(wParam)), 0L)
/* void Class::MDIRestore(HWND hwndRestore) */
#define DISPATCH_WM_MDIRESTORE(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* HWND Class::MDINext(HWND hwndCur, BOOL fPrev) */
#define DISPATCH_WM_MDINEXT(wParam, lParam, fn) \
(LRESULT)(HWND)(fn)((HWND)(wParam), (BOOL)lParam)
/* void Class::MDIMaximize(HWND hwndMaximize) */
#define DISPATCH_WM_MDIMAXIMIZE(wParam, lParam, fn) \
((fn)((HWND)(wParam)), 0L)
/* BOOL Class::MDITile(UINT cmd) */
#define DISPATCH_WM_MDITILE(wParam, lParam, fn) \
(LRESULT)(DWORD)(fn)((UINT)(wParam))
/* BOOL Class::MDICascade(UINT cmd) */
#define DISPATCH_WM_MDICASCADE(wParam, lParam, fn) \
(LRESULT)(DWORD)(fn)((UINT)(wParam))
/* void Class::MDIIconArrange() */
#define DISPATCH_WM_MDIICONARRANGE(wParam, lParam, fn) \
((fn)(), 0L)
/* HWND Class::MDIGetActive() */
#define DISPATCH_WM_MDIGETACTIVE(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)()
/* HMENU Class::MDISetMenu(BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) */
#define DISPATCH_WM_MDISETMENU(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)((BOOL)(wParam), (HMENU)(wParam), (HMENU)(lParam))
/* void Class::OnChildActivate() */
#define DISPATCH_WM_CHILDACTIVATE(wParam, lParam, fn) \
((fn)(), 0L)
/* BOOL Class::OnInitDialog(HWND hwndFocus, LPARAM lParam) */
#define DISPATCH_WM_INITDIALOG(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(BOOL)(fn)((HWND)(wParam), lParam)
/* HWND Class::OnNextDlgCtl(HWND hwndSetFocus, BOOL fNext) */
#define DISPATCH_WM_NEXTDLGCTL(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HWND)(fn)((HWND)(wParam), (BOOL)(lParam))
/* void Class::OnParentNotify(UINT msg, HWND hwndChild, int idChild) */
#define DISPATCH_WM_PARENTNOTIFY(wParam, lParam, fn) \
((fn)((UINT)LOWORD(wParam), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
/* void Class:OnParentNotifyReflect(UINT msg) */
#define DISPATCH_OCM_PARENTNOTIFY(wParam, lParam, fn) \
((fn)((UINT)LOWORD(wParam)), 0L)
/* void Class::OnEnterIdle(UINT source, HWND hwndSource) */
#define DISPATCH_WM_ENTERIDLE(wParam, lParam, fn) \
((fn)((UINT)(wParam), (HWND)(lParam)), 0L)
/* UINT Class::OnGetDlgCode(LPMSG lpmsg) */
#define DISPATCH_WM_GETDLGCODE(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(fn)((LPMSG)(lParam))
/* HBRUSH Class::OnCtlColor(HDC hdc, HWND hwndChild, int type) */
#define DISPATCH_WM_CTLCOLORMSGBOX(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_MSGBOX)
#define DISPATCH_WM_CTLCOLOREDIT(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_EDIT)
#define DISPATCH_WM_CTLCOLORLISTBOX(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_LISTBOX)
#define DISPATCH_WM_CTLCOLORBTN(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_BTN)
#define DISPATCH_WM_CTLCOLORDLG(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_DLG)
#define DISPATCH_WM_CTLCOLORSCROLLBAR(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_SCROLLBAR)
#define DISPATCH_WM_CTLCOLORSTATIC(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), (HWND)(lParam), CTLCOLOR_STATIC)
/* HBRUSH Class::OnCtlColorReflect(HDC hdc, int type) */
#define DISPATCH_OCM_CTLCOLORMSGBOX(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_MSGBOX)
#define DISPATCH_OCM_CTLCOLOREDIT(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_EDIT)
#define DISPATCH_OCM_CTLCOLORLISTBOX(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_LISTBOX)
#define DISPATCH_OCM_CTLCOLORBTN(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_BTN)
#define DISPATCH_OCM_CTLCOLORDLG(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_DLG)
#define DISPATCH_OCM_CTLCOLORSCROLLBAR(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_SCROLLBAR)
#define DISPATCH_OCM_CTLCOLORSTATIC(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HBRUSH)(fn)((HDC)(wParam), CTLCOLOR_STATIC)
/* void Class::OnSetFont(HFONT hfont, BOOL fRedraw) */
#define DISPATCH_WM_SETFONT(wParam, lParam, fn) \
((fn)((HFONT)(wParam), (BOOL)(lParam)), 0L)
/* HFONT Class::OnGetFont() */
#define DISPATCH_WM_GETFONT(wParam, lParam, fn) \
(LRESULT)(DWORD)(UINT)(HFONT)(fn)()
/* void Class::OnDrawItem(const DRAWITEMSTRUCT * lpDrawItem) */
#define DISPATCH_WM_DRAWITEM(wParam, lParam, fn) \
((fn)((const DRAWITEMSTRUCT *)(lParam)), 0L)
/* void Class::OnDrawItemReflect(const DRAWITEMSTRUCT * lpDrawItem) */
#define DISPATCH_OCM_DRAWITEM(wParam, lParam, fn) \
((fn)((const DRAWITEMSTRUCT *)(lParam)), 0L)
/* void Class::OnMeasureItem(MEASUREITEMSTRUCT * lpMeasureItem) */
#define DISPATCH_WM_MEASUREITEM(wParam, lParam, fn) \
((fn)((MEASUREITEMSTRUCT *)(lParam)), 0L)
/* void Class::OnMeasureItemReflect(MEASUREITEMSTRUCT * lpMeasureItem) */
#define DISPATCH_OCM_MEASUREITEM(wParam, lParam, fn) \
((fn)((MEASUREITEMSTRUCT *)(lParam)), 0L)
/* void Class::OnDeleteItem(const DELETEITEMSTRUCT * lpDeleteItem) */
#define DISPATCH_WM_DELETEITEM(wParam, lParam, fn) \
((fn)((const DELETEITEMSTRUCT *)(lParam)), 0L)
/* void Class::OnDeleteItemReflect(const DELETEITEMSTRUCT * lpDeleteItem) */
#define DISPATCH_OCM_DELETEITEM(wParam, lParam, fn) \
((fn)((const DELETEITEMSTRUCT *)(lParam)), 0L)
/* int Class::OnCompareItem(const COMPAREITEMSTRUCT * lpCompareItem) */
#define DISPATCH_WM_COMPAREITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((const COMPAREITEMSTRUCT *)(lParam))
/* int Class::OnCompareItemReflect(const COMPAREITEMSTRUCT * lpCompareItem) */
#define DISPATCH_OCM_COMPAREITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((const COMPAREITEMSTRUCT *)(lParam))
/* int Class::OnVkeyToItem(UINT vk, HWND hwndListbox, int iCaret) */
#define DISPATCH_WM_VKEYTOITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
/* int Class::OnVkeyToItemReflect(UINT vk, int iCaret) */
#define DISPATCH_OCM_VKEYTOITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((UINT)LOWORD(wParam), (int)(short)HIWORD(wParam))
/* int Class::OnCharToItem(UINT ch, HWND hwndListbox, int iCaret) */
#define DISPATCH_WM_CHARTOITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((UINT)LOWORD(wParam), (HWND)(lParam), (int)(short)HIWORD(wParam))
/* int Class::OnCharToItemReflect(UINT ch, int iCaret) */
#define DISPATCH_OCM_CHARTOITEM(wParam, lParam, fn) \
(LRESULT)(DWORD)(int)(fn)((UINT)LOWORD(wParam), (int)(short)HIWORD(wParam))
/* void Class::OnQueueSync() */
#define DISPATCH_WM_QUEUESYNC(wParam, lParam, fn) \
((fn)(), 0L)
#if (WINVER >= 0x030a)
/* void Class::OnCommNotify(int cid, UINT flags) */
#define DISPATCH_WM_COMMNOTIFY(wParam, lParam, fn) \
((fn)((int)(wParam), (UINT)LOWORD(lParam)), 0L)
#endif
/* void Class::OnDisplayChange(UINT bitsPerPixel, UINT cxScreen, UINT cyScreen) */
#define DISPATCH_WM_DISPLAYCHANGE(wParam, lParam, fn) \
((fn)((UINT)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(wParam)), 0L)
/* BOOL Class::OnDeviceChange(UINT uEvent, DWORD dwEventData) */
#define DISPATCH_WM_DEVICECHANGE(wParam, lParam, fn) \
(LRESULT)(DWORD)(BOOL)(fn)((UINT)(wParam), (DWORD)(wParam))
/* void Class::OnContextMenu(HWND hwndContext, UINT xPos, UINT yPos) */
#define DISPATCH_WM_CONTEXTMENU(wParam, lParam, fn) \
((fn)((HWND)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L)
#endif // !defined(_SUBCLASSWND_H_199B246E_AE5D_11D3_A459_000629B2F85_INCLUDED_)