按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
建造(building)程序,获得的二进制文件将放在不同的子目录中。
264
…………………………………………………………Page 327……………………………………………………………
第4章 Visual C++ 整合性軟體開發環境
一行程序代码都还没写,就获得了这么多类别。
265
…………………………………………………………Page 328……………………………………………………………
第篇 欲善工事先利其器
一行程序代码都还没写,就获得了这么多资源。
一行程序代码都没写,只是点点按按,我们就获得了一个令人惊艳的程序。基本功能一应俱全(文件
对话框、打印机设定、Help、工具栏、状态列。。。),却什么也不能做(那是当然)。
266
…………………………………………………………Page 329……………………………………………………………
第4章 Visual C++ 整合性軟體開發環境
AppWizard 总是为一般的应用程序产生五个类别。我所谓的「一般程序」是指non…OLE
以及non…ODBC 程序。针对上述的Scribble 程序,它产生的类别列于图4…7 。
类别名称 基础类别 类别声明于 类别定义于
CScribbleApp CWinApp Scribble。h Scribble。cpp
CMainFrame CMDIFrameWnd Mainfrm。h Mainfrm。cpp
CChildFrame CMDIChildWnd Childfrm。h Childfrm。cpp
CScribbleDoc CDocument ScribbleDoc。h ScribbleDoc。cpp
CScribbleView CView ScribbleView。h ScribbleView。cpp
图4…7 Scribble Step0 ( 骨干程序)中,各个类别的相关资料。事实上Scribble
程序中用到了 9 个类别,不过只有上述 5 个类别需要改写 (override)。
你最好把哪一个类别衍生自哪一个MFC 类别弄清楚,并搞懂AppWizard 的命名规则。
大致上命名规则是这样的:
'C' + ProjectName + Classtype = Class Name
所有的类别名称都由AppWizard 自动命名,如果你喜欢,也可以在AppWizard 的步骤六
改变之。这些类别名称可以很长很长(Windows 95 与Windows NT 均支持长档名)。每
个类别都对应一个。H (类别声明)和一个。CPP (类别定义)。
AppWizard 十分周到地为我们产生了一个README。TXT ,对各个文件都有解释(图4
8) 。从激活AppWizard 到建立Scribble。exe ,如果你是熟手,机器又不慢的话,不需要
一分钟。拿着码表算时间其实不具意义(就像计算程序行数多寡一样地不具意义),我
要说的是它的确便利。
267
…………………………………………………………Page 330……………………………………………………………
第篇 欲善工事先利其器
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : Scribble
========================================================================
AppWizard has created this Scribble application for you。 This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application。
This file contains a summary of what you will find in each of the files that
make up your Scribble application。
Scribble。h
This is the main header file for the application。 It includes other
project specific headers (including Resource。h) and declares the
CScribbleApp application class。
Scribble。cpp
This is the main application source file that contains the application
class CScribbleApp。
Scribble。rc
This is a listing of all of the Microsoft Windows resources that the
program uses。 It includes the icons; bitmaps; and cursors that are stored
in the RES subdirectory。 This file can be directly edited in Microsoft
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 f