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
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
|
// Windows Template Library - WTL version 8.1
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLCRACK_H__
#define __ATLCRACK_H__
#pragma once
#ifndef __ATLAPP_H__
#error atlcrack.h requires atlapp.h to be included first
#endif
///////////////////////////////////////////////////////////////////////////////
// Message map macro for cracked handlers
// Note about message maps with cracked handlers:
// For ATL 3.0, a message map using cracked handlers MUST use BEGIN_MSG_MAP_EX.
// For ATL 7.0 or higher, you can use BEGIN_MSG_MAP for CWindowImpl/CDialogImpl derived classes,
// but must use BEGIN_MSG_MAP_EX for classes that don't derive from CWindowImpl/CDialogImpl.
#define BEGIN_MSG_MAP_EX(theClass) \
public: \
BOOL m_bMsgHandled; \
/* "handled" management for cracked handlers */ \
BOOL IsMsgHandled() const \
{ \
return m_bMsgHandled; \
} \
void SetMsgHandled(BOOL bHandled) \
{ \
m_bMsgHandled = bHandled; \
} \
BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \
{ \
BOOL bOldMsgHandled = m_bMsgHandled; \
BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \
m_bMsgHandled = bOldMsgHandled; \
return bRet; \
} \
BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \
{ \
BOOL bHandled = TRUE; \
hWnd; \
uMsg; \
wParam; \
lParam; \
lResult; \
bHandled; \
switch(dwMsgMapID) \
{ \
case 0:
///////////////////////////////////////////////////////////////////////////////
// Standard Windows message macros
// int OnCreate(LPCREATESTRUCT lpCreateStruct)
#define MSG_WM_CREATE(func) \
if (uMsg == WM_CREATE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
#define MSG_WM_INITDIALOG(func) \
if (uMsg == WM_INITDIALOG) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct)
#define MSG_WM_COPYDATA(func) \
if (uMsg == WM_COPYDATA) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDestroy()
#define MSG_WM_DESTROY(func) \
if (uMsg == WM_DESTROY) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMove(CPoint ptPos)
#define MSG_WM_MOVE(func) \
if (uMsg == WM_MOVE) \
{ \
SetMsgHandled(TRUE); \
func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSize(UINT nType, CSize size)
#define MSG_WM_SIZE(func) \
if (uMsg == WM_SIZE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther)
#define MSG_WM_ACTIVATE(func) \
if (uMsg == WM_ACTIVATE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSetFocus(CWindow wndOld)
#define MSG_WM_SETFOCUS(func) \
if (uMsg == WM_SETFOCUS) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnKillFocus(CWindow wndFocus)
#define MSG_WM_KILLFOCUS(func) \
if (uMsg == WM_KILLFOCUS) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnEnable(BOOL bEnable)
#define MSG_WM_ENABLE(func) \
if (uMsg == WM_ENABLE) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPaint(CDCHandle dc)
#define MSG_WM_PAINT(func) \
if (uMsg == WM_PAINT) \
{ \
SetMsgHandled(TRUE); \
func((HDC)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnClose()
#define MSG_WM_CLOSE(func) \
if (uMsg == WM_CLOSE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnQueryEndSession(UINT nSource, UINT uLogOff)
#define MSG_WM_QUERYENDSESSION(func) \
if (uMsg == WM_QUERYENDSESSION) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnQueryOpen()
#define MSG_WM_QUERYOPEN(func) \
if (uMsg == WM_QUERYOPEN) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnEraseBkgnd(CDCHandle dc)
#define MSG_WM_ERASEBKGND(func) \
if (uMsg == WM_ERASEBKGND) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysColorChange()
#define MSG_WM_SYSCOLORCHANGE(func) \
if (uMsg == WM_SYSCOLORCHANGE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnEndSession(BOOL bEnding, UINT uLogOff)
#define MSG_WM_ENDSESSION(func) \
if (uMsg == WM_ENDSESSION) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam, (UINT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnShowWindow(BOOL bShow, UINT nStatus)
#define MSG_WM_SHOWWINDOW(func) \
if (uMsg == WM_SHOWWINDOW) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam, (int)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit)
#define MSG_WM_CTLCOLOREDIT(func) \
if (uMsg == WM_CTLCOLOREDIT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox)
#define MSG_WM_CTLCOLORLISTBOX(func) \
if (uMsg == WM_CTLCOLORLISTBOX) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button)
#define MSG_WM_CTLCOLORBTN(func) \
if (uMsg == WM_CTLCOLORBTN) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd)
#define MSG_WM_CTLCOLORDLG(func) \
if (uMsg == WM_CTLCOLORDLG) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
#define MSG_WM_CTLCOLORSCROLLBAR(func) \
if (uMsg == WM_CTLCOLORSCROLLBAR) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic)
#define MSG_WM_CTLCOLORSTATIC(func) \
if (uMsg == WM_CTLCOLORSTATIC) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
#define MSG_WM_SETTINGCHANGE(func) \
if (uMsg == WM_SETTINGCHANGE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPCTSTR)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDevModeChange(LPCTSTR lpDeviceName)
#define MSG_WM_DEVMODECHANGE(func) \
if (uMsg == WM_DEVMODECHANGE) \
{ \
SetMsgHandled(TRUE); \
func((LPCTSTR)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnActivateApp(BOOL bActive, DWORD dwThreadID)
#define MSG_WM_ACTIVATEAPP(func) \
if (uMsg == WM_ACTIVATEAPP) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam, (DWORD)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnFontChange()
#define MSG_WM_FONTCHANGE(func) \
if (uMsg == WM_FONTCHANGE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnTimeChange()
#define MSG_WM_TIMECHANGE(func) \
if (uMsg == WM_TIMECHANGE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCancelMode()
#define MSG_WM_CANCELMODE(func) \
if (uMsg == WM_CANCELMODE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message)
#define MSG_WM_SETCURSOR(func) \
if (uMsg == WM_SETCURSOR) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message)
#define MSG_WM_MOUSEACTIVATE(func) \
if (uMsg == WM_MOUSEACTIVATE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnChildActivate()
#define MSG_WM_CHILDACTIVATE(func) \
if (uMsg == WM_CHILDACTIVATE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnGetMinMaxInfo(LPMINMAXINFO lpMMI)
#define MSG_WM_GETMINMAXINFO(func) \
if (uMsg == WM_GETMINMAXINFO) \
{ \
SetMsgHandled(TRUE); \
func((LPMINMAXINFO)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnIconEraseBkgnd(CDCHandle dc)
#define MSG_WM_ICONERASEBKGND(func) \
if (uMsg == WM_ICONERASEBKGND) \
{ \
SetMsgHandled(TRUE); \
func((HDC)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSpoolerStatus(UINT nStatus, UINT nJobs)
#define MSG_WM_SPOOLERSTATUS(func) \
if (uMsg == WM_SPOOLERSTATUS) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (UINT)LOWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
#define MSG_WM_DRAWITEM(func) \
if (uMsg == WM_DRAWITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
#define MSG_WM_MEASUREITEM(func) \
if (uMsg == WM_MEASUREITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
#define MSG_WM_DELETEITEM(func) \
if (uMsg == WM_DELETEITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
//int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
#define MSG_WM_CHARTOITEM(func) \
if (uMsg == WM_CHARTOITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
#define MSG_WM_VKEYTOITEM(func) \
if (uMsg == WM_VKEYTOITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HCURSOR OnQueryDragIcon()
#define MSG_WM_QUERYDRAGICON(func) \
if (uMsg == WM_QUERYDRAGICON) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
#define MSG_WM_COMPAREITEM(func) \
if (uMsg == WM_COMPAREITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCompacting(UINT nCpuTime)
#define MSG_WM_COMPACTING(func) \
if (uMsg == WM_COMPACTING) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct)
#define MSG_WM_NCCREATE(func) \
if (uMsg == WM_NCCREATE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcDestroy()
#define MSG_WM_NCDESTROY(func) \
if (uMsg == WM_NCDESTROY) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam)
#define MSG_WM_NCCALCSIZE(func) \
if (uMsg == WM_NCCALCSIZE) \
{ \
SetMsgHandled(TRUE); \
lResult = func((BOOL)wParam, lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// UINT OnNcHitTest(CPoint point)
#define MSG_WM_NCHITTEST(func) \
if (uMsg == WM_NCHITTEST) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(_WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcPaint(CRgnHandle rgn)
#define MSG_WM_NCPAINT(func) \
if (uMsg == WM_NCPAINT) \
{ \
SetMsgHandled(TRUE); \
func((HRGN)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnNcActivate(BOOL bActive)
#define MSG_WM_NCACTIVATE(func) \
if (uMsg == WM_NCACTIVATE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((BOOL)wParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// UINT OnGetDlgCode(LPMSG lpMsg)
#define MSG_WM_GETDLGCODE(func) \
if (uMsg == WM_GETDLGCODE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((LPMSG)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcMouseMove(UINT nHitTest, CPoint point)
#define MSG_WM_NCMOUSEMOVE(func) \
if (uMsg == WM_NCMOUSEMOVE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcLButtonDown(UINT nHitTest, CPoint point)
#define MSG_WM_NCLBUTTONDOWN(func) \
if (uMsg == WM_NCLBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcLButtonUp(UINT nHitTest, CPoint point)
#define MSG_WM_NCLBUTTONUP(func) \
if (uMsg == WM_NCLBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcLButtonDblClk(UINT nHitTest, CPoint point)
#define MSG_WM_NCLBUTTONDBLCLK(func) \
if (uMsg == WM_NCLBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcRButtonDown(UINT nHitTest, CPoint point)
#define MSG_WM_NCRBUTTONDOWN(func) \
if (uMsg == WM_NCRBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcRButtonUp(UINT nHitTest, CPoint point)
#define MSG_WM_NCRBUTTONUP(func) \
if (uMsg == WM_NCRBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcRButtonDblClk(UINT nHitTest, CPoint point)
#define MSG_WM_NCRBUTTONDBLCLK(func) \
if (uMsg == WM_NCRBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcMButtonDown(UINT nHitTest, CPoint point)
#define MSG_WM_NCMBUTTONDOWN(func) \
if (uMsg == WM_NCMBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcMButtonUp(UINT nHitTest, CPoint point)
#define MSG_WM_NCMBUTTONUP(func) \
if (uMsg == WM_NCMBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNcMButtonDblClk(UINT nHitTest, CPoint point)
#define MSG_WM_NCMBUTTONDBLCLK(func) \
if (uMsg == WM_NCMBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_KEYDOWN(func) \
if (uMsg == WM_KEYDOWN) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_KEYUP(func) \
if (uMsg == WM_KEYUP) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_CHAR(func) \
if (uMsg == WM_CHAR) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_DEADCHAR(func) \
if (uMsg == WM_DEADCHAR) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_SYSKEYDOWN(func) \
if (uMsg == WM_SYSKEYDOWN) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_SYSKEYUP(func) \
if (uMsg == WM_SYSKEYUP) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_SYSCHAR(func) \
if (uMsg == WM_SYSCHAR) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_SYSDEADCHAR(func) \
if (uMsg == WM_SYSDEADCHAR) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSysCommand(UINT nID, LPARAM lParam)
#define MSG_WM_SYSCOMMAND(func) \
if (uMsg == WM_SYSCOMMAND) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnTCard(UINT idAction, DWORD dwActionData)
#define MSG_WM_TCARD(func) \
if (uMsg == WM_TCARD) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (DWORD)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnTimer(UINT_PTR nIDEvent)
#define MSG_WM_TIMER(func) \
if (uMsg == WM_TIMER) \
{ \
SetMsgHandled(TRUE); \
func((UINT_PTR)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
#define MSG_WM_HSCROLL(func) \
if (uMsg == WM_HSCROLL) \
{ \
SetMsgHandled(TRUE); \
func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
#define MSG_WM_VSCROLL(func) \
if (uMsg == WM_VSCROLL) \
{ \
SetMsgHandled(TRUE); \
func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnInitMenu(CMenuHandle menu)
#define MSG_WM_INITMENU(func) \
if (uMsg == WM_INITMENU) \
{ \
SetMsgHandled(TRUE); \
func((HMENU)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnInitMenuPopup(CMenuHandle menuPopup, UINT nIndex, BOOL bSysMenu)
#define MSG_WM_INITMENUPOPUP(func) \
if (uMsg == WM_INITMENUPOPUP) \
{ \
SetMsgHandled(TRUE); \
func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMenuSelect(UINT nItemID, UINT nFlags, CMenuHandle menu)
#define MSG_WM_MENUSELECT(func) \
if (uMsg == WM_MENUSELECT) \
{ \
SetMsgHandled(TRUE); \
func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenuHandle menu)
#define MSG_WM_MENUCHAR(func) \
if (uMsg == WM_MENUCHAR) \
{ \
SetMsgHandled(TRUE); \
lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotify(int idCtrl, LPNMHDR pnmh)
#define MSG_WM_NOTIFY(func) \
if (uMsg == WM_NOTIFY) \
{ \
SetMsgHandled(TRUE); \
lResult = func((int)wParam, (LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnEnterIdle(UINT nWhy, CWindow wndWho)
#define MSG_WM_ENTERIDLE(func) \
if (uMsg == WM_ENTERIDLE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMouseMove(UINT nFlags, CPoint point)
#define MSG_WM_MOUSEMOVE(func) \
if (uMsg == WM_MOUSEMOVE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
#define MSG_WM_MOUSEWHEEL(func) \
if (uMsg == WM_MOUSEWHEEL) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnLButtonDown(UINT nFlags, CPoint point)
#define MSG_WM_LBUTTONDOWN(func) \
if (uMsg == WM_LBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnLButtonUp(UINT nFlags, CPoint point)
#define MSG_WM_LBUTTONUP(func) \
if (uMsg == WM_LBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnLButtonDblClk(UINT nFlags, CPoint point)
#define MSG_WM_LBUTTONDBLCLK(func) \
if (uMsg == WM_LBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRButtonDown(UINT nFlags, CPoint point)
#define MSG_WM_RBUTTONDOWN(func) \
if (uMsg == WM_RBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRButtonUp(UINT nFlags, CPoint point)
#define MSG_WM_RBUTTONUP(func) \
if (uMsg == WM_RBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRButtonDblClk(UINT nFlags, CPoint point)
#define MSG_WM_RBUTTONDBLCLK(func) \
if (uMsg == WM_RBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMButtonDown(UINT nFlags, CPoint point)
#define MSG_WM_MBUTTONDOWN(func) \
if (uMsg == WM_MBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMButtonUp(UINT nFlags, CPoint point)
#define MSG_WM_MBUTTONUP(func) \
if (uMsg == WM_MBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMButtonDblClk(UINT nFlags, CPoint point)
#define MSG_WM_MBUTTONDBLCLK(func) \
if (uMsg == WM_MBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam)
#define MSG_WM_PARENTNOTIFY(func) \
if (uMsg == WM_PARENTNOTIFY) \
{ \
SetMsgHandled(TRUE); \
func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMDIActivate(CWindow wndActivate, CWindow wndDeactivate)
#define MSG_WM_MDIACTIVATE(func) \
if (uMsg == WM_MDIACTIVATE) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRenderFormat(UINT nFormat)
#define MSG_WM_RENDERFORMAT(func) \
if (uMsg == WM_RENDERFORMAT) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRenderAllFormats()
#define MSG_WM_RENDERALLFORMATS(func) \
if (uMsg == WM_RENDERALLFORMATS) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDestroyClipboard()
#define MSG_WM_DESTROYCLIPBOARD(func) \
if (uMsg == WM_DESTROYCLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDrawClipboard()
#define MSG_WM_DRAWCLIPBOARD(func) \
if (uMsg == WM_DRAWCLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct)
#define MSG_WM_PAINTCLIPBOARD(func) \
if (uMsg == WM_PAINTCLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \
::GlobalUnlock((HGLOBAL)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
#define MSG_WM_VSCROLLCLIPBOARD(func) \
if (uMsg == WM_VSCROLLCLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnContextMenu(CWindow wnd, CPoint point)
#define MSG_WM_CONTEXTMENU(func) \
if (uMsg == WM_CONTEXTMENU) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect)
#define MSG_WM_SIZECLIPBOARD(func) \
if (uMsg == WM_SIZECLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \
::GlobalUnlock((HGLOBAL)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString)
#define MSG_WM_ASKCBFORMATNAME(func) \
if (uMsg == WM_ASKCBFORMATNAME) \
{ \
SetMsgHandled(TRUE); \
func((DWORD)wParam, (LPTSTR)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter)
#define MSG_WM_CHANGECBCHAIN(func) \
if (uMsg == WM_CHANGECBCHAIN) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos)
#define MSG_WM_HSCROLLCLIPBOARD(func) \
if (uMsg == WM_HSCROLLCLIPBOARD) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnQueryNewPalette()
#define MSG_WM_QUERYNEWPALETTE(func) \
if (uMsg == WM_QUERYNEWPALETTE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPaletteChanged(CWindow wndFocus)
#define MSG_WM_PALETTECHANGED(func) \
if (uMsg == WM_PALETTECHANGED) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPaletteIsChanging(CWindow wndPalChg)
#define MSG_WM_PALETTEISCHANGING(func) \
if (uMsg == WM_PALETTEISCHANGING) \
{ \
SetMsgHandled(TRUE); \
func((HWND)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDropFiles(HDROP hDropInfo)
#define MSG_WM_DROPFILES(func) \
if (uMsg == WM_DROPFILES) \
{ \
SetMsgHandled(TRUE); \
func((HDROP)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnWindowPosChanging(LPWINDOWPOS lpWndPos)
#define MSG_WM_WINDOWPOSCHANGING(func) \
if (uMsg == WM_WINDOWPOSCHANGING) \
{ \
SetMsgHandled(TRUE); \
func((LPWINDOWPOS)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnWindowPosChanged(LPWINDOWPOS lpWndPos)
#define MSG_WM_WINDOWPOSCHANGED(func) \
if (uMsg == WM_WINDOWPOSCHANGED) \
{ \
SetMsgHandled(TRUE); \
func((LPWINDOWPOS)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnExitMenuLoop(BOOL fIsTrackPopupMenu)
#define MSG_WM_EXITMENULOOP(func) \
if (uMsg == WM_EXITMENULOOP) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnEnterMenuLoop(BOOL fIsTrackPopupMenu)
#define MSG_WM_ENTERMENULOOP(func) \
if (uMsg == WM_ENTERMENULOOP) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
#define MSG_WM_STYLECHANGED(func) \
if (uMsg == WM_STYLECHANGED) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
#define MSG_WM_STYLECHANGING(func) \
if (uMsg == WM_STYLECHANGING) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPSTYLESTRUCT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSizing(UINT fwSide, LPRECT pRect)
#define MSG_WM_SIZING(func) \
if (uMsg == WM_SIZING) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPRECT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMoving(UINT fwSide, LPRECT pRect)
#define MSG_WM_MOVING(func) \
if (uMsg == WM_MOVING) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPRECT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCaptureChanged(CWindow wnd)
#define MSG_WM_CAPTURECHANGED(func) \
if (uMsg == WM_CAPTURECHANGED) \
{ \
SetMsgHandled(TRUE); \
func((HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnDeviceChange(UINT nEventType, DWORD dwData)
#define MSG_WM_DEVICECHANGE(func) \
if (uMsg == WM_DEVICECHANGE) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam, (DWORD)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
#define MSG_WM_COMMAND(func) \
if (uMsg == WM_COMMAND) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen)
#define MSG_WM_DISPLAYCHANGE(func) \
if (uMsg == WM_DISPLAYCHANGE) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, _WTYPES_NS::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnEnterSizeMove()
#define MSG_WM_ENTERSIZEMOVE(func) \
if (uMsg == WM_ENTERSIZEMOVE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnExitSizeMove()
#define MSG_WM_EXITSIZEMOVE(func) \
if (uMsg == WM_EXITSIZEMOVE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// HFONT OnGetFont()
#define MSG_WM_GETFONT(func) \
if (uMsg == WM_GETFONT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnGetHotKey()
#define MSG_WM_GETHOTKEY(func) \
if (uMsg == WM_GETHOTKEY) \
{ \
SetMsgHandled(TRUE); \
lResult = func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// HICON OnGetIcon()
#define MSG_WM_GETICON(func) \
if (uMsg == WM_GETICON) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnGetText(int cchTextMax, LPTSTR lpszText)
#define MSG_WM_GETTEXT(func) \
if (uMsg == WM_GETTEXT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnGetTextLength()
#define MSG_WM_GETTEXTLENGTH(func) \
if (uMsg == WM_GETTEXTLENGTH) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnHelp(LPHELPINFO lpHelpInfo)
#define MSG_WM_HELP(func) \
if (uMsg == WM_HELP) \
{ \
SetMsgHandled(TRUE); \
func((LPHELPINFO)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey)
#define MSG_WM_HOTKEY(func) \
if (uMsg == WM_HOTKEY) \
{ \
SetMsgHandled(TRUE); \
func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout)
#define MSG_WM_INPUTLANGCHANGE(func) \
if (uMsg == WM_INPUTLANGCHANGE) \
{ \
SetMsgHandled(TRUE); \
func((DWORD)wParam, (HKL)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout)
#define MSG_WM_INPUTLANGCHANGEREQUEST(func) \
if (uMsg == WM_INPUTLANGCHANGEREQUEST) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam, (HKL)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus)
#define MSG_WM_NEXTDLGCTL(func) \
if (uMsg == WM_NEXTDLGCTL) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)LOWORD(lParam), wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu)
#define MSG_WM_NEXTMENU(func) \
if (uMsg == WM_NEXTMENU) \
{ \
SetMsgHandled(TRUE); \
func((int)wParam, (LPMDINEXTMENU)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnNotifyFormat(CWindow wndFrom, int nCommand)
#define MSG_WM_NOTIFYFORMAT(func) \
if (uMsg == WM_NOTIFYFORMAT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, (int)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD dwData)
#define MSG_WM_POWERBROADCAST(func) \
if (uMsg == WM_POWERBROADCAST) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((DWORD)wParam, (DWORD)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPrint(CDCHandle dc, UINT uFlags)
#define MSG_WM_PRINT(func) \
if (uMsg == WM_PRINT) \
{ \
SetMsgHandled(TRUE); \
func((HDC)wParam, (UINT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPrintClient(CDCHandle dc, UINT uFlags)
#define MSG_WM_PRINTCLIENT(func) \
if (uMsg == WM_PRINTCLIENT) \
{ \
SetMsgHandled(TRUE); \
func((HDC)wParam, (UINT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError)
#define MSG_WM_RASDIALEVENT(func) \
if (uMsg == WM_RASDIALEVENT) \
{ \
SetMsgHandled(TRUE); \
func((RASCONNSTATE)wParam, (DWORD)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSetFont(CFontHandle font, BOOL bRedraw)
#define MSG_WM_SETFONT(func) \
if (uMsg == WM_SETFONT) \
{ \
SetMsgHandled(TRUE); \
func((HFONT)wParam, (BOOL)LOWORD(lParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnSetHotKey(int nVirtKey, UINT uFlags)
#define MSG_WM_SETHOTKEY(func) \
if (uMsg == WM_SETHOTKEY) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \
if(IsMsgHandled()) \
return TRUE; \
}
// HICON OnSetIcon(UINT uType, HICON hIcon)
#define MSG_WM_SETICON(func) \
if (uMsg == WM_SETICON) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnSetRedraw(BOOL bRedraw)
#define MSG_WM_SETREDRAW(func) \
if (uMsg == WM_SETREDRAW) \
{ \
SetMsgHandled(TRUE); \
func((BOOL)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnSetText(LPCTSTR lpstrText)
#define MSG_WM_SETTEXT(func) \
if (uMsg == WM_SETTEXT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((LPCTSTR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnUserChanged()
#define MSG_WM_USERCHANGED(func) \
if (uMsg == WM_USERCHANGED) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// New NT4 & NT5 messages
#if(_WIN32_WINNT >= 0x0400)
// void OnMouseHover(WPARAM wParam, CPoint ptPos)
#define MSG_WM_MOUSEHOVER(func) \
if (uMsg == WM_MOUSEHOVER) \
{ \
SetMsgHandled(TRUE); \
func(wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMouseLeave()
#define MSG_WM_MOUSELEAVE(func) \
if (uMsg == WM_MOUSELEAVE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
#endif /* _WIN32_WINNT >= 0x0400 */
#if(WINVER >= 0x0500)
// void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu)
#define MSG_WM_MENURBUTTONUP(func) \
if (uMsg == WM_MENURBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func(wParam, (HMENU)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnMenuDrag(WPARAM wParam, CMenuHandle menu)
#define MSG_WM_MENUDRAG(func) \
if (uMsg == WM_MENUDRAG) \
{ \
SetMsgHandled(TRUE); \
lResult = func(wParam, (HMENU)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info)
#define MSG_WM_MENUGETOBJECT(func) \
if (uMsg == WM_MENUGETOBJECT) \
{ \
SetMsgHandled(TRUE); \
lResult = func((PMENUGETOBJECTINFO)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnUnInitMenuPopup(UINT nID, CMenuHandle menu)
#define MSG_WM_UNINITMENUPOPUP(func) \
if (uMsg == WM_UNINITMENUPOPUP) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(lParam), (HMENU)wParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnMenuCommand(WPARAM nIndex, CMenuHandle menu)
#define MSG_WM_MENUCOMMAND(func) \
if (uMsg == WM_MENUCOMMAND) \
{ \
SetMsgHandled(TRUE); \
func(wParam, (HMENU)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
#endif /* WINVER >= 0x0500 */
#if(_WIN32_WINNT >= 0x0500)
// BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys)
#define MSG_WM_APPCOMMAND(func) \
if (uMsg == WM_APPCOMMAND) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos)
#define MSG_WM_NCXBUTTONDOWN(func) \
if (uMsg == WM_NCXBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos)
#define MSG_WM_NCXBUTTONUP(func) \
if (uMsg == WM_NCXBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos)
#define MSG_WM_NCXBUTTONDBLCLK(func) \
if (uMsg == WM_NCXBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos)
#define MSG_WM_XBUTTONDOWN(func) \
if (uMsg == WM_XBUTTONDOWN) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos)
#define MSG_WM_XBUTTONUP(func) \
if (uMsg == WM_XBUTTONUP) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos)
#define MSG_WM_XBUTTONDBLCLK(func) \
if (uMsg == WM_XBUTTONDBLCLK) \
{ \
SetMsgHandled(TRUE); \
func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnChangeUIState(WORD nAction, WORD nState)
#define MSG_WM_CHANGEUISTATE(func) \
if (uMsg == WM_CHANGEUISTATE) \
{ \
SetMsgHandled(TRUE); \
func(LOWORD(wParam), HIWORD(wParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnUpdateUIState(WORD nAction, WORD nState)
#define MSG_WM_UPDATEUISTATE(func) \
if (uMsg == WM_UPDATEUISTATE) \
{ \
SetMsgHandled(TRUE); \
func(LOWORD(wParam), HIWORD(wParam)); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnQueryUIState()
#define MSG_WM_QUERYUISTATE(func) \
if (uMsg == WM_QUERYUISTATE) \
{ \
SetMsgHandled(TRUE); \
lResult = func(); \
if(IsMsgHandled()) \
return TRUE; \
}
#endif // (_WIN32_WINNT >= 0x0500)
#if(_WIN32_WINNT >= 0x0501)
// void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput)
#define MSG_WM_INPUT(func) \
if (uMsg == WM_INPUT) \
{ \
SetMsgHandled(TRUE); \
func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags)
#define MSG_WM_UNICHAR(func) \
if (uMsg == WM_UNICHAR) \
{ \
SetMsgHandled(TRUE); \
func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \
if(IsMsgHandled()) \
{ \
lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \
return TRUE; \
} \
}
// void OnWTSSessionChange(WPARAM nStatusCode, PWTSSESSION_NOTIFICATION nSessionID)
#define MSG_WM_WTSSESSION_CHANGE(func) \
if (uMsg == WM_WTSSESSION_CHANGE) \
{ \
SetMsgHandled(TRUE); \
func(wParam, (PWTSSESSION_NOTIFICATION)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// OnThemeChanged()
#define MSG_WM_THEMECHANGED(func) \
if (uMsg == WM_THEMECHANGED) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
#endif /* _WIN32_WINNT >= 0x0501 */
///////////////////////////////////////////////////////////////////////////////
// ATL defined messages
// BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData)
#define MSG_WM_FORWARDMSG(func) \
if (uMsg == WM_FORWARDMSG) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Dialog specific messages
// LRESULT OnDMGetDefID()
#define MSG_DM_GETDEFID(func) \
if (uMsg == DM_GETDEFID) \
{ \
SetMsgHandled(TRUE); \
lResult = func(); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDMSetDefID(UINT DefID)
#define MSG_DM_SETDEFID(func) \
if (uMsg == DM_SETDEFID) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnDMReposition()
#define MSG_DM_REPOSITION(func) \
if (uMsg == DM_REPOSITION) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Reflected messages
// void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl)
#define MSG_OCM_COMMAND(func) \
if (uMsg == OCM_COMMAND) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh)
#define MSG_OCM_NOTIFY(func) \
if (uMsg == OCM_NOTIFY) \
{ \
SetMsgHandled(TRUE); \
lResult = func((int)wParam, (LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam)
#define MSG_OCM_PARENTNOTIFY(func) \
if (uMsg == OCM_PARENTNOTIFY) \
{ \
SetMsgHandled(TRUE); \
func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
#define MSG_OCM_DRAWITEM(func) \
if (uMsg == OCM_DRAWITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
#define MSG_OCM_MEASUREITEM(func) \
if (uMsg == OCM_MEASUREITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct)
#define MSG_OCM_COMPAREITEM(func) \
if (uMsg == OCM_COMPAREITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct)
#define MSG_OCM_DELETEITEM(func) \
if (uMsg == OCM_DELETEITEM) \
{ \
SetMsgHandled(TRUE); \
func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \
lResult = TRUE; \
if(IsMsgHandled()) \
return TRUE; \
}
// int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox)
#define MSG_OCM_VKEYTOITEM(func) \
if (uMsg == OCM_VKEYTOITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
//int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox)
#define MSG_OCM_CHARTOITEM(func) \
if (uMsg == OCM_CHARTOITEM) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
#define MSG_OCM_HSCROLL(func) \
if (uMsg == OCM_HSCROLL) \
{ \
SetMsgHandled(TRUE); \
func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
#define MSG_OCM_VSCROLL(func) \
if (uMsg == OCM_VSCROLL) \
{ \
SetMsgHandled(TRUE); \
func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit)
#define MSG_OCM_CTLCOLOREDIT(func) \
if (uMsg == OCM_CTLCOLOREDIT) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox)
#define MSG_OCM_CTLCOLORLISTBOX(func) \
if (uMsg == OCM_CTLCOLORLISTBOX) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button)
#define MSG_OCM_CTLCOLORBTN(func) \
if (uMsg == OCM_CTLCOLORBTN) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd)
#define MSG_OCM_CTLCOLORDLG(func) \
if (uMsg == OCM_CTLCOLORDLG) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar)
#define MSG_OCM_CTLCOLORSCROLLBAR(func) \
if (uMsg == OCM_CTLCOLORSCROLLBAR) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic)
#define MSG_OCM_CTLCOLORSTATIC(func) \
if (uMsg == OCM_CTLCOLORSTATIC) \
{ \
SetMsgHandled(TRUE); \
lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Edit specific messages
// void OnClear()
#define MSG_WM_CLEAR(func) \
if (uMsg == WM_CLEAR) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCopy()
#define MSG_WM_COPY(func) \
if (uMsg == WM_COPY) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCut()
#define MSG_WM_CUT(func) \
if (uMsg == WM_CUT) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnPaste()
#define MSG_WM_PASTE(func) \
if (uMsg == WM_PASTE) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnUndo()
#define MSG_WM_UNDO(func) \
if (uMsg == WM_UNDO) \
{ \
SetMsgHandled(TRUE); \
func(); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Generic message handlers
// LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MESSAGE_HANDLER_EX(msg, func) \
if(uMsg == msg) \
{ \
SetMsgHandled(TRUE); \
lResult = func(uMsg, wParam, lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \
if(uMsg >= msgFirst && uMsg <= msgLast) \
{ \
SetMsgHandled(TRUE); \
lResult = func(uMsg, wParam, lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
///////////////////////////////////////////////////////////////////////////////
// Commands and notifications
// void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define COMMAND_HANDLER_EX(id, code, func) \
if (uMsg == WM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define COMMAND_ID_HANDLER_EX(id, func) \
if (uMsg == WM_COMMAND && id == LOWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define COMMAND_CODE_HANDLER_EX(code, func) \
if (uMsg == WM_COMMAND && code == HIWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotifyHandlerEX(LPNMHDR pnmh)
#define NOTIFY_HANDLER_EX(id, cd, func) \
if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh)
#define NOTIFY_ID_HANDLER_EX(id, func) \
if (uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh)
#define NOTIFY_CODE_HANDLER_EX(cd, func) \
if (uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh)
#define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
#define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \
if (uMsg == OCM_COMMAND && code == HIWORD(wParam) && id == LOWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \
if (uMsg == OCM_COMMAND && id == LOWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \
if (uMsg == OCM_COMMAND && code == HIWORD(wParam)) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh)
#define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \
if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && id == ((LPNMHDR)lParam)->idFrom) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh)
#define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \
if (uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh)
#define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \
if (uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \
if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl)
#define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \
if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \
{ \
SetMsgHandled(TRUE); \
func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \
lResult = 0; \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh)
#define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \
if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
// LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh)
#define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \
if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \
{ \
SetMsgHandled(TRUE); \
lResult = func((LPNMHDR)lParam); \
if(IsMsgHandled()) \
return TRUE; \
}
#endif // __ATLCRACK_H__
|