11 typedef void (CCmdTarget::*AFX_PMSG)( void);
12 typedef void (CWnd::*AFX_PMSGW)( void);
14 struct AFX_MSGMAP_ENTRY {
15 unsigned int nMessage;
20 const AFX_MSGMAP* pBaseMap;
21 const AFX_MSGMAP_ENTRY* lpEntries;
28 static AFX_MSGMAP_ENTRY _messageEntries[];
30 static const AFX_MSGMAP messageMap;
31 virtual const AFX_MSGMAP* GetMessageMap() const;
34 const AFX_MSGMAP CCmdTarget::messageMap = {
35 0, &CCmdTarget::_messageEntries[0]
38 const AFX_MSGMAP* CCmdTarget::GetMessageMap() const {
39 return &CCmdTarget::messageMap;
42 AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] =
47 CCmdTarget :: CCmdTarget() { }
49 class CWnd : public CCmdTarget {
56 static AFX_MSGMAP_ENTRY _messageEntries[];
58 static const AFX_MSGMAP messageMap;
59 virtual const AFX_MSGMAP* GetMessageMap() const;
65 void CWnd :: OnPaint() {
68 const AFX_MSGMAP* CWnd ::GetMessageMap() const {
69 return & CWnd ::messageMap;
71 const AFX_MSGMAP CWnd ::messageMap = {
72 & CCmdTarget ::messageMap, & CWnd ::_messageEntries[0]
74 AFX_MSGMAP_ENTRY CWnd ::_messageEntries[] = {
77 class CFrameWnd : public CWnd {
82 static AFX_MSGMAP_ENTRY _messageEntries[];
84 static const AFX_MSGMAP messageMap;
85 virtual const AFX_MSGMAP* GetMessageMap() const;
88 CFrameWnd :: CFrameWnd() { }
90 const AFX_MSGMAP* CFrameWnd ::GetMessageMap() const {
91 return & CFrameWnd ::messageMap;
93 const AFX_MSGMAP CFrameWnd ::messageMap = {
94 & CWnd ::messageMap, & CFrameWnd ::_messageEntries[0]
96 AFX_MSGMAP_ENTRY CFrameWnd ::_messageEntries[] = {
99 class CMainWindow : public CFrameWnd {
105 static AFX_MSGMAP_ENTRY _messageEntries[];
107 static const AFX_MSGMAP messageMap;
108 virtual const AFX_MSGMAP* GetMessageMap() const;
111 CMainWindow :: CMainWindow()
114 void CMainWindow :: OnPaint()
119 void CMainWindow :: callProc()
121 const AFX_MSGMAP* pMessageMap;
122 const AFX_MSGMAP_ENTRY *lpEntry;
124 pMessageMap = GetMessageMap();
125 lpEntry = pMessageMap->lpEntries;
127 if( lpEntry->nMessage == 100) {
128 (this->*lpEntry->pfn)();
132 const AFX_MSGMAP* CMainWindow ::GetMessageMap() const {
133 return & CMainWindow ::messageMap;
135 const AFX_MSGMAP CMainWindow ::messageMap = {
136 & CFrameWnd ::messageMap, & CMainWindow ::_messageEntries[0]
138 AFX_MSGMAP_ENTRY CMainWindow ::_messageEntries[] = {
139 { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint },
143 int main( int argc, char **argv) {
144 CMainWindow myWindow;