按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
#0184 virtual LRESULT DefWindowProc(UINT message; WPARAM wParam; LPARAM lParam);
#0185 virtual BOOL Onmand(WPARAM wParam; LPARAM lParam);
#0186
#0187 DECLARE_MESSAGE_MAP()
#0188 };
#0189
#0190 class CView;
#0191
#0192 class CFrameWnd : public CWnd
#0193 {
#0194 public:
#0195 CView* m_pViewActive; // current active view
#0196
#0197 public:
#0198 CFrameWnd::CFrameWnd() {
#0199 }
#0200 CFrameWnd::~CFrameWnd() {
#0201 }
#0202 BOOL Create();
#0203 CView* GetActiveView() const;
#0204 virtual BOOL PreCreateWindow();
#0205 virtual BOOL Onmand(WPARAM wParam; LPARAM lParam);
#0206 virtual BOOL OnCmdMsg(UINT nID; int nCode);
#0207
#0208 DECLARE_MESSAGE_MAP()
#0209
#0210 friend CView;
#0211 };
#0212
#0213 class CView : public CWnd
#0214 {
#0215 public:
#0216 CDocument* m_pDocument;
#0217
#0218 public:
#0219 CView::CView() {
#0220 }
#0221 CView::~CView() {
#0222 }
#0223
#0224 virtual BOOL OnCmdMsg(UINT nID; int nCode);
207
…………………………………………………………Page 270……………………………………………………………
第篇 勿在浮砂築高台
#0225
#0226 DECLARE_MESSAGE_MAP()
#0227
#0228 friend CFrameWnd;
#0229 };
#0230
#0231 // global function
#0232 CWinApp* AfxGetApp();
#0233 LRESULT AfxWndProc(HWND hWnd; UINT nMsg; WPARAM wParam; LPARAM lParam;
#0234 CWnd* pWnd); // last param。 pWnd is added by JJHOU。
#0235 LRESULT AfxCallWndProc(CWnd* pWnd; HWND hWnd; UINT nMsg; WPARAM wParam;
#0236 LPARAM lParam);
AFXMSG_。H
#0001 enum AfxSig
#0002 {
#0003 AfxSig_end = 0; // 'marks end of message map'
#0004 AfxSig_vv;
#0005 };
#0006
#0007 #define ON_MAND(id; memberFxn)
#0008 { WM_MAND; 0; (WORD)id; (WORD)id; AfxSig_vv; (AFX_PMSG)memberFxn };
MFC。CPP
#0001 #include 〃my。h〃 // 原该包含mfc。h 就好,但为了extern CMyWinApp 所以 。。。
#0002
#0003 extern CMyWinApp theApp;
#0004 extern void printlpEntries(AFX_MSGMAP_ENTRY* lpEntry);
#0005
#0006 BOOL CCmdTarget::OnCmdMsg(UINT nID; int nCode)
#0007 {
#0008 // Now look through message map to see if it applies to us
#0009 AFX_MSGMAP* pMessageMap;
#0010 AFX_MSGMAP_ENTRY* lpEntry;
#0011 for (pMessageMap = GetMessageMap(); pMessageMap != NULL;
#0012 pMessageMap = pMessageMap…》pBaseMessageMap)
#0013 {
#0014 lpEntry = pMessageMap…》lpEntries;
#0015 printlpEntries(lpEntry);
#0016 }
#0017
#0018 return FALSE; // not handled
#0019 }
208
…………………………………………………………Page 271……………………………………………………………
第3章 MFC 六大關鍵技術之模擬
#0020
#0021 BOOL CWnd::Create()
#0022 {
#0023 cout pfn;
#0062 // otherwise should call DefWindowProc。
#0063 }
#0064
#0065 LRESULT CWnd::DefWindowProc(UINT message; WPARAM wParam; LPARAM lParam)
209
…………………………………………………………Page 272……………………………………………………………
第篇 勿在浮砂築高台
#0066 {
#0067 return TRUE;
#0068 }
#0069
#0070 BOOL CWnd::Onmand(WPARAM wParam; LPARAM lParam)
#0071 {
#0072 // 。。。
#0073 return OnCmdMsg(0; 0);
#0074 }
#0075
#0076 BOOL CFrameWnd::Onmand(WPARAM wParam; LPARAM lParam)
#0077 {
#0078 // 。。。
#0079 // route as normal mand
#0080 return CWnd::Onmand(wParam; lParam);
#0081 }
#0082
#0083 BOOL CFrameWnd::Create()
#0084 {
#0085 cout OnCmdMsg(nID; nCode))
#0115 return TRUE;
#0116
#0117