友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!
第三电子书 返回本书目录 加入书签 我的书架 我的书签 TXT全本下载 『收藏到我的浏览器』

深入浅出MFC第2版(PDF格式)-第45部分

快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部! 如果本书没有阅读完,想下次继续接着阅读,可使用上方 "收藏到我的浏览器" 功能 和 "加入书签" 功能!


     1    CCmdTarget 



     pMyView received a WM_MAND; routing path and call stack: 

     AfxWndProc() 



                                                                                   201 


…………………………………………………………Page 264……………………………………………………………

                   第篇  勿在浮砂築高台 



                        AfxCallWndProc() 

                        CWnd::WindowProc() 

                        CWnd::Onmand() 

                        CView::OnCmdMsg() 

                        CCmdTarget::OnCmdMsg() 

                        1221    CMyView 

                        122    CView 

                        12    CWnd 

                        1    CCmdTarget 

                        CDocument::OnCmdMsg() 

                        CCmdTarget::OnCmdMsg() 

                        131    CMyDoc 

                        13    CDocument 

                        1    CCmdTarget 

                        CWnd::DefWindowProc() 



                        pMyFrame received a WM_MAND; routing path and call stack: 

                        AfxWndProc() 

                        AfxCallWndProc() 

                        CWnd::WindowProc() 

                        CFrameWnd::Onmand() 

                        CWnd::Onmand() 

                        CFrameWnd::OnCmdMsg() 

                        CFrameWnd::GetActiveView() 

                        CView::OnCmdMsg() 

                        CCmdTarget::OnCmdMsg() 

                        1221    CMyView 

                        122    CView 

                        12    CWnd 

                        1    CCmdTarget 

                        CDocument::OnCmdMsg() 

                        CCmdTarget::OnCmdMsg() 

                        131    CMyDoc 

                        13    CDocument 

                        1    CCmdTarget 

                        CCmdTarget::OnCmdMsg() 

                        1211    CMyFrameWnd 

                        121    CFrameWnd 

                        12    CWnd 

                        1    CCmdTarget 

                        CCmdTarget::OnCmdMsg() 

                        1111    CMyWinApp 

                        111    CWinApp 

                        1    CCmdTarget 

                        CWnd::DefWindowProc() 



202 


…………………………………………………………Page 265……………………………………………………………

                                                          第3章    MFC 六大關鍵技術之模擬 



Frame8 范例程序 



        MFC。H 



        #0001  #define TRUE 1 

        #0002  #define FALSE 0 

        #0003 

        #0004  typedef char* LPSTR; 

        #0005  typedef const char* LPCSTR; 

        #0006 

        #0007  typedef unsigned long  DWORD; 

        #0008  typedef int              BOOL; 

        #0009  typedef unsigned char  BYTE; 

        #0010  typedef unsigned short WORD; 

        #0011  typedef int              INT; 

        #0012  typedef unsigned int   UINT; 

        #0013  typedef long             LONG; 

        #0014 

        #0015  typedef UINT           WPARAM; 

        #0016  typedef LONG           LPARAM; 

        #0017  typedef LONG           LRESULT; 

        #0018  typedef int            HWND; 

        #0019 

        #0020  #define WM_MAND             0x0111 

        #0021  #define WM_CREATE              0x0001 

        #0022  #define WM_PAINT               0x000F 

        #0023  #define WM_NOTIFY              0x004E 

        #0024 

        #0025  #define CObjectid              0xffff 

        #0026  #define   CCmdTargetid         1 

        #0027  #define     CWinThreadid       11 

        #0028  #define       CWinAppid        111 

        #0029  #define         CMyWinAppid    1111 

        #0030  #define     CWndid             12 

        #0031  #define       CFrameWndid      121 

        #0032  #define         CMyFrameWndid  1211 

        #0033  #define       CViewid          122 

        #0034  #define         CMyViewid      1221 

        #0035  #define     CDocumentid        13 

        #0036  #define       CMyDocid         131 

        #0037 

        #0038  #include  

        #0039 

        #0040  ///////////////////////////////////////////////////////////////// 



                                                                                            203 


…………………………………………………………Page 266……………………………………………………………

                    第篇  勿在浮砂築高台 



                    #0041  // Window message map handling 

                    #0042 

                    #0043  struct AFX_MSGMAP_ENTRY;       // declared below after CWnd 

                    #0044 

                    #0045  struct AFX_MSGMAP 

                    #0046  { 

                    #0047          AFX_MSGMAP* pBaseMessageMap; 

                    #0048          AFX_MSGMAP_ENTRY* lpEntries; 

                    #0049  }; 

                    #0050 

                    #0051  #define DECLARE_MESSAGE_MAP()  

                    #0052          static AFX_MSGMAP_ENTRY _messageEntries'';  

                    #0053          static AFX_MSGMAP messageMap;  

                    #0054          virtual AFX_MSGMAP* GetMessageMap() const; 

                    #0055 

                    #0056  #define BEGIN_MESSAGE_MAP(theClass; baseClass)  

                    #0057          AFX_MSGMAP* theClass::GetMessageMap() const  

                    #0058                  { return &theClass::messageMap; }  

                    #0059          AFX_MSGMAP theClass::messageMap =  

                    #0060          { &(baseClass::messageMap);  

                    #0061                  (AFX_MSGMAP_ENTRY*) &(theClass::_messageEntries) };  

                    #0062          AFX_MSGMAP_ENTRY theClass::_messageEntries'' =  

                    #0063          { 

                    #0064 

                    #0065  #define END_MESSAGE_MAP()  

                    #0066          { 0; 0; 0; 0; AfxSig_end; (AFX_PMSG)0 }  

                    #0067          }; 

                    #0068 

                    #0069  // Message map signature values and macros in separate header 

                    #0070  #include 〃afxmsg_。h〃 

                    #0071 

                    #0072  class CObject 

                    #0073  { 

                    #0074  public: 

                    #0075    CObject::CObject()  { 

                    #0076                           } 

                    #0077    CObject::~CObject() { 

                    #0078                           } 

                    #0079  }; 

                    #0080 

                    #0081  class CCmdTarget : public CObject 

                    #0082  { 

                    #0083  public: 

                    #0084    CCmdTarget::CCmdTarget()  { 

                    #0085                                   } 

                    #0086    CCmdTarget::~CCmdTarget() { 



204 


…………………………………………………………Page 267……………………………………………………………

                                                     第3章    MFC 六大關鍵技術之模擬 



#0087                                   } 

#0088 

#0089    virtual BOOL OnCmdMsg(UINT nID; int nCode); 

#0090 

#0091    DECLARE_MESSAGE_MAP()       // base class no {{ }} macros 

#0092  }; 

#0093 

#0094  typedef void (CCmdTarget::*AFX_PMSG)(void); 

#0095 

#0096  struct AFX_MSGMAP_ENTRY  // MFC 4。0 

#0097  { 

#0098      UINT nMessage; // windows message 

#0099      UINT nCode;    // control code or WM_NOTIFY code 

#0100      UINT nID;      // control ID (or 0 for windows messages) 

#0101      UINT nLastID;  // used for entries specifying a range of control id's 

#0102      UINT nSig;     // signature type (action) or pointer to message # 

#0103      AFX_PMSG pfn;  // routine to call (or special value) 

#0104  }; 

#0105 

#0106  class CWinThread : public CCmdTarget 

#0107  { 

#0108  public: 

#0109    CWinThread::CWinThread()  { 

#0110                                   } 

#0111    CWinThread::~CWinThread() { 

#0112                                   } 

#0113 

#0114    virtual BOOL InitInstance() { 

#0115                                      cout 
返回目录 上一页 下一页 回到顶部 0 0
快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!