按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
Developer Studio。
resScribble。ico
This is an icon file; which is used as the application's icon。 This
icon is included by the main resource file Scribble。rc。
resScribble。rc2
This file contains resources that are not edited by Microsoft
Developer Studio。 You should place all resources not
editable by the resource editor in this file。
Scribble。clw
This file contains information used by ClassWizard to edit existing
classes or add new classes。 ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions。
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
268
…………………………………………………………Page 331……………………………………………………………
第4章 Visual C++ 整合性軟體開發環境
MainFrm。h; MainFrm。cpp
These files contain the frame class CMainFrame; which is derived from
CMDIFrameWnd and controls all MDI frame features。
resToolbar。bmp
This bitmap file is used to create tiled images for the toolbar。
The initial toolbar and status bar are constructed in the
CMainFrame class。 Edit this toolbar bitmap along with the
array in MainFrm。cpp to add more toolbar buttons。
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
ScribbleDoc。h; ScribbleDoc。cpp the document
These files contain your CScribbleDoc class。 Edit these files to
add your special document data and to implement file saving and loading
(via CScribbleDoc::Serialize)。
ScribbleView。h; ScribbleView。cpp the view of the document
These files contain your CScribbleView class。
CScribbleView objects are used to view CScribbleDoc objects。
resScribbleDoc。ico
This is an icon file; which is used as the icon for MDI child windows
for the CScribbleDoc class。 This icon is included by the main
resource file Scribble。rc。
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx。h; StdAfx。cpp
These files are used to build a prepiled header (PCH) file
named Scribble。pch and a prepiled types file named StdAfx。obj。
Resource。h
This is the standard header file; which defines new resource IDs。
Microsoft Developer Studio reads and updates this file。
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses 〃TODO:〃 to indicate parts of the source code you
should add to or customize。
269
…………………………………………………………Page 332……………………………………………………………
第篇 欲善工事先利其器
If your application uses MFC in a shared DLL; and your application is
in a language other than the operating system's current language; you
will need to copy the corresponding localized resources MFC40XXX。DLL
from the Microsoft Visual C++ CD…ROM onto the system or system32 directory;
and rename it to be MFCLOC。DLL。 (〃XXX〃 stands for the language abbreviation。
For example; MFC40DEU。DLL contains resources translated to German。) If you
don't do this; some of the UI elements of your application will remain in the
language of the operating system。
图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