按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
#0113 CWinApp* pApp = AfxGetApp();
#0114 if (pApp…》OnCmdMsg(nID; nCode))
#0115 return TRUE;
#0116
#0117 return FALSE;
#0118 }
#0119
#0120 BOOL CDocument::OnCmdMsg(UINT nID; int nCode)
#0121 {
#0122 if (CCmdTarget::OnCmdMsg(nID; nCode))
#0123 return TRUE;
#0124
#0125 return FALSE;
#0126 }
#0127
#0128 BOOL CView::OnCmdMsg(UINT nID; int nCode)
#0129 {
#0130 if (CWnd::OnCmdMsg(nID; nCode))
#0131 return TRUE;
#0132
#0133 BOOL bHandled = FALSE;
#0134 bHandled = m_pDocument…》OnCmdMsg(nID; nCode);
#0135 return bHandled;
#0136 }
#0137
#0138 AFX_MSGMAP* CCmdTarget::GetMessageMap() const
#0139 {
#0140 return &CCmdTarget::messageMap;
#0141 }
#0142
#0143 AFX_MSGMAP CCmdTarget::messageMap =
#0144 {
#0145 NULL;
#0146 &CCmdTarget::_messageEntries'0'
#0147 };
#0148
#0149 AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries'' =
#0150 {
#0151
#0152 { 0; 0; CCmdTargetid; 0; AfxSig_end; 0 }
#0153 };
#0154
#0155 BEGIN_MESSAGE_MAP(CWnd; CCmdTarget)
#0156 ON_MAND(CWndid; 0)
#0157 END_MESSAGE_MAP()
211
…………………………………………………………Page 274……………………………………………………………
第篇 勿在浮砂築高台
#0158
#0159 BEGIN_MESSAGE_MAP(CFrameWnd; CWnd)
#0160 ON_MAND(CFrameWndid; 0)
#0161 END_MESSAGE_MAP()
#0162
#0163 BEGIN_MESSAGE_MAP(CDocument; CCmdTarget)
#0164 ON_MAND(CDocumentid; 0)
#0165 END_MESSAGE_MAP()
#0166
#0167 BEGIN_MESSAGE_MAP(CView; CWnd)
#0168 ON_MAND(CViewid; 0)
#0169 END_MESSAGE_MAP()
#0170
#0171 BEGIN_MESSAGE_MAP(CWinApp; CCmdTarget)
#0172 ON_MAND(CWinAppid; 0)
#0173 END_MESSAGE_MAP()
#0174
#0175 CWinApp* AfxGetApp()
#0176 {
#0177 return theApp。m_pCurrentWinApp;
#0178 }
#0179
#0180 LRESULT AfxWndProc(HWND hWnd; UINT nMsg; WPARAM wParam; LPARAM lParam;
#0181 CWnd *pWnd) // last parameter pWnd is added by JJHou。
#0182 {
#0183 //。。。
#0184 return AfxCallWndProc(pWnd; hWnd; nMsg; wParam; lParam);
#0185 }
#0186
#0187 LRESULT AfxCallWndProc(CWnd* pWnd; HWND hWnd; UINT nMsg;
WPARAM wParam; LPARAM lParam)
#0188 {
#0189 LRESULT lResult = pWnd…》WindowProc(nMsg; wParam; lParam);
#0190 return lResult;
#0191 }
MY。H
#0001 #include
#0002 #include 〃mfc。h〃
#0003
#0004 class CMyWinApp : public CWinApp
#0005 {
#0006 public:
#0007 CMyWinApp::CMyWinApp() {
#0008 }
212
…………………………………………………………Page 275……………………………………………………………
第3章 MFC 六大關鍵技術之模擬
#0009 CMyWinApp::~CMyWinApp() {
#0010 }
#0011 virtual BOOL InitInstance();
#0012 DECLARE_MESSAGE_MAP()
#0013 };
#0014
#0015 class CMyFrameWnd : public CFrameWnd
#0016 {
#0017 public:
#0018 CMyFrameWnd();
#0019 ~CMyFrameWnd() {
#0020 }
#0021 DECLARE_MESSAGE_MAP()
#0022 };
#0023
#0024 class CMyDoc : public CDocument
#0025 {
#0026 public:
#0027 CMyDoc::CMyDoc() {
#0028 }
#0029 CMyDoc::~CMyDoc() {
#0030 }
#0031 DECLARE_MESSAGE_MAP()
#0032 };
#0033
#0034 class CMyView : public CView
#0035 {
#0036 public:
#0037 CMyView::CMyView() {
#0038 }
#0039 CMyView::~CMyView() {
#0040 }
#0041 DECLARE_MESSAGE_MAP()
#0042 };
MY。CPP
#0001 #include 〃my。h〃
#0002
#0003 CMyWinApp theApp; // global object
#0004
#0005 BOOL CMyWinApp::InitInstance()
#0006 {
#0007 cout nID)
214
…………………………………………………………Page 277……………………………………………………………
第3章 MFC 六大關鍵技術之模擬
#0056 {
#0057 cout nID