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

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

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




                  图4…8 Scribble 程序的readme。txt 档。 



                  别忘了,AppWizard 产生的是化学反应而不是物理反应,是不能够还原的。我们很容易 



                  犯的错误是像进入糖果店里的小孩一样,每样东西都想要。你应该约束自己,因为错一 



                  步已是百年身,不能稍后又回到AppWizard 要求去掉或改变某些选项,例如想把SDI 改 



                  为MDI 或是想增加OLE 支持等等,都不能够。欲变更程序,只有两条路可走:要不 



                  就令AppWizard 重新产生一组新的程序骨干,然后回到原程序中打捞点什么可以用的, 



                  以Copy/Paste 方式移植过来;要不就是直接进入原来程序修修补补。至于修补过程中到 



                  底会多么令人厌烦,那就不一而论了。所以,在开始你的程序撰写之前,小心做好系统 



                  分析的工作。 



                  Scribble 是第四篇程序的起点。我将在第四篇以每章一个主题的方式,为它加上新的功 



                  能。下面是Scribble step0 的源代码。 



                  SCRIBBLE。H 



                  #0001  // Scribble。h : main header file for the SCRIBBLE application 

                  #0002  // 

                  #0003 

                  #0004  #ifndef __AFXWIN_H__ 

                  #0005   #error include 'stdafx。h' before including this file for PCH 

                  #0006  #endif 

                  #0007 

                  #0008  #include 〃resource。h〃       // main symbols 

                  #0009 

                  #0010  ///////////////////////////////////////////////////////////////// 

                  #0011  // CScribbleApp: 

                  #0012  // See Scribble。cpp for the implementation of this class 

                  #0013  // 



270 


…………………………………………………………Page 333……………………………………………………………

                                            第4章    Visual C++  整合性軟體開發環境 



#0014 

#0015  class CScribbleApp : public CWinApp 

#0016  { 

#0017  public: 

#0018   CScribbleApp(); 

#0019 

#0020  // Overrides 

#0021   // ClassWizard generated virtual function overrides 

#0022   //{{AFX_VIRTUAL(CScribbleApp) 

#0023   public: 

#0024   virtual BOOL InitInstance (); 

#0025   //}}AFX_VIRTUAL 

#0026 

#0027  // Implementation 

#0028 

#0029   //{{AFX_MSG(CScribbleApp) 

#0030   afx_msg void OnAppAbout(); 

#0031       // NOTE the ClassWizard will add and remove member functions here。 

#0032       //    DO NOT EDIT what you see in these blocks of generated code ! 

#0033   //}}AFX_MSG 

#0034   DECLARE_MESSAGE_MAP () 

#0035  }; 



MAINFRM。H 



#0001  // MainFrm。h : interface of the CMainFrame class 

#0002  // 

#0003  ///////////////////////////////////////////////////////////////// 

#0004 

#0005  class CMainFrame : public CMDIFrameWnd 

#0006  { 

#0007   DECLARE_DYNAMIC (CMainFrame) 

#0008  public: 

#0009   CMainFrame(); 

#0010 

#0011  // Attributes 

#0012  public: 

#0013 

#0014  // Operations 

#0015  public: 

#0016 

#0017  // Overrides 

#0018   // ClassWizard generated virtual function overrides 

#0019   //{{AFX_VIRTUAL(CMainFrame) 

#0020   virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 

#0021   //}}AFX_VIRTUAL 



                                                                                    271 


…………………………………………………………Page 334……………………………………………………………

                   第篇    欲善工事先利其器 



                   #0022 

                   #0023  // Implementation 

                   #0024  public: 

                   #0025   virtual ~CMainFrame(); 

                   #0026  #ifdef _DEBUG 

                   #0027   virtual void AssertValid() const; 

                   #0028   virtual void Dump(CDumpContext& dc) const; 

                   #0029  #endif 

                   #0030 

                   #0031  protected:  // control bar embedded members 

                   #0032   CStatusBar  m_wndStatusBar; 

                   #0033   CToolBar    m_wndToolBar; 

                   #0034 

                   #0035  // Generated message map functions 

                   #0036  protected: 

                   #0037   //{{AFX_MSG(CMainFrame) 

                   #0038   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 

                   #0039       // NOTE the ClassWizard will add and remove member functions here。 

                   #0040       //    DO NOT EDIT what you see in these blocks of generated code! 

                   #0041   //}}AFX_MSG 

                   #0042   DECLARE_MESSAGE_MAP () 

                   #0043  }; 



                   CHILDFRM。H 



                   #0001  // ChildFrm。h : interface of the CChildFrame class 

                   #0002  // 

                   #0003  ///////////////////////////////////////////////////////////////// 

                   #0004 

                   #0005  class CChildFrame : public CMDIChildWnd 

                   #0006  { 

                   #0007   DECLARE_DYNCREATE (CChildFrame) 

                   #0008  public: 

                   #0009   CChildFrame(); 

                   #0010 

                   #0011  // Attributes 

                   #0012  public: 

                   #0013 

                   #0014  // Operations 

                   #0015  public: 

                   #0016 

                   #0017  // Overrides 

                   #0018   // ClassWizard generated virtual function overrides 

                   #0019   //{{AFX_VIRTUAL(CChildFrame) 

                   #0020   virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 

                   #0021   //}}AFX_VIRTUAL 



272 


…………………………………………………………Page 335……………………………………………………………

                                            第4章    Visual C++  整合性軟體開發環境 



#0022 

#0023  // Implementation 

#0024  public: 

#0025   virtual ~CChildFrame(); 

#0026  #ifdef _DEBUG 

#0027   virtual void AssertValid() const; 

#0028   virtual void Dump(CDumpContext& dc) const; 

#0029  #endif 

#0030 

#0031  // Generated message map functions 

#0032  protected: 

#0033   //{{AFX_MSG(CChildFrame) 

#0034       // NOTE the ClassWizard will add and remove member functions here。 

#0035       //    DO NOT EDIT what you see in these blocks of generated code! 

#0036   //}}AFX_MSG 

#0037   DECLARE_MESSAGE_MAP () 

#0038  }; 



SCRIBBLEDOC。H 



#0001  // ScribbleDoc。h : interface of the CScribbleDoc class 

#0002  // 

#0003  ///////////////////////////////////////////////////////////////// 

#0004 

#0005  class CScribbleDoc : public CDocument 

#0006  { 

#0007  protected: // create from serialization only 

#0008   CScribbleDoc(); 

#0009   DECLARE_DYNCREATE (CScribbleDoc) 

#0010 

#0011  // Attributes 

#0012  public: 

#0013 

#0014  // Operations 

#0015  public: 

#0016 

#0017  // Overrides 

#0018   // ClassWizard generated virtual function overrides 

#0019   //{{AFX_VIRTUAL(CScribbleDoc) 

#0020   public: 

#0021   virtual BOOL OnNewDocument(); 

#0022   virtual void Serialize (CArchive& ar); 

#0023   //}}AFX_VIRTUAL 

#0024 

#0025  // Implementation 

#0026  public: 



                                                                                   273 


…………………………………………………………Page 336……………………………………………………………

                   第篇    欲善工事先利其器 



                   #0027   virtual ~CScribbleDoc(); 

                   #0028  #ifdef _DEBUG 

                   #0029   virtual void AssertValid() const; 

                   #0030   virtual void Dump(CDumpContext& dc) const; 

                   #0031  #endif 

                   #0032 

                   #0033  protected: 

                   #0034 

                   #0035  // Generated message map functions 

                   #0036  protected: 

                   #0037   //{{AFX_MSG(CScribbleDoc) 

                   #0038       // NOTE the ClassWizard will add and remove member functions here。 

                   #0039       //    DO NOT EDIT what you see in these blocks of generated code ! 

                   #0040   //}}AFX_MSG 

                   #0041   DECLARE_MESSAGE_MAP () 

                   #0042  }; 



                   SCRIBBLEVIEW。H 



                   #0001  // ScribbleView。h : interface of the CScribbleView class 

                   #0002  // 

                   #0003  ///////////////////////////////////////////////////////////////// 

                   #0004 

                   #0005  class CScribbleView : public CView 

                   #0006  { 

                   #0007  protected: // create from serialization only 

                   #0008   CScribbleView(); 

                   #0009   DECLARE_DYNCREATE (CScribbleView) 

                   #0010 

                   #0011  // Attributes 

                   #0012  public: 

                   #0013   CScribbleDoc* GetDocument(); 

                   #0014 

                   #0015  // Operations 

                   #0016  public: 

                   #0017 

                   #0018  // Overrides 

                   #0019   // ClassWizard generated virtual function overrides 

                   #0020   //{{AFX_VIRTUAL(CScribbleView) 

                   #0021   public: 

                   #0022   virtual void OnDraw (CDC* pDC);  // overridden to draw this view 

                   #0023   virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 

                   #0024   protected: 

                   #0025   virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 

                   #0026   virtual void OnBeginPrinting(CDC* pDC; CPrintInfo* pInfo); 

                   #0027   virtual void OnEndPrinting(CDC* pDC; CPrintInfo* pInfo); 



274 


…………………………………………………………Page 337……………………………………………………………

                                            第4章    Visual C++  整合性軟體開發環境 



#0028   //}}AFX_VIRTUAL 

#0029 

#0030  // Implementation 

#0031  public: 

#0032   virtual ~CScribbleView(); 

#0033  #ifdef _DEBUG 

#0034   virtual void AssertValid() const; 

#0035   virtual void Dump(CDumpContext& dc) const; 

#0036  #endif 

#0037 

#0038  protected: 

#0039 

#0040  // Generated message map functions 

#0041  protected: 

#0042   //{{AFX_MSG(CScribbleView) 

#0043       // NOTE the ClassWizard will add and remove member functions here。 

#0044       //    DO NOT EDIT what you see in these blocks of generated code ! 

#0045   //}}AFX_MSG 

#0046   DECLARE_MESSAGE_MAP () 

#0047  }; 

#0048 

#0049  #ifndef _DEBUG  // debug version in ScribbleView。cpp 

#0050  inline CScribbleDoc* CScribbleView::GetDocument() 

#0051     { return (CScribbleDoc*)m_pDocument; } 

#0052  #endif 



STDAFX。H 



#0001  // stdafx。h : include file for standard system include files; 

#0002  //  or project specific include files that are used frequently; but 

#0003  //      are changed infrequently 

#0004  // 

#0005 

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