========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : Ex_MDI
========================================================================
AppWizard has created this Ex_MDI 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 Ex_MDI application.
Ex_MDI.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
Ex_MDI.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CEx_MDIApp application class.
Ex_MDI.cpp
This is the main application source file that contains the application
class CEx_MDIApp.
Ex_MDI.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
Visual C++.
Ex_MDI.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.
res\Ex_MDI.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file Ex_MDI.rc.
res\Ex_MDI.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CMDIFrameWnd and controls all MDI frame features.
res\Toolbar.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 using the resource editor, and
update the IDR_MAINFRAME TOOLBAR array in Ex_MDI.rc to add
toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
For the child frame window:
ChildFrm.h, ChildFrm.cpp
These files define and implement the CChildFrame class, which
supports the child windows in an MDI application.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
Ex_MDIDoc.h, Ex_MDIDoc.cpp - the document
These files contain your CEx_MDIDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CEx_MDIDoc::Serialize).
Ex_MDIView.h, Ex_MDIView.cpp - the view of the document
These files contain your CEx_MDIView class.
CEx_MDIView objects are used to view CEx_MDIDoc objects.
res\Ex_MDIDoc.ico
This is an icon file, which is used as the icon for MDI child windows
for the CEx_MDIDoc class. This icon is included by the main
resource file Ex_MDI.rc.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Ex_MDI.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
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 MFC42XXX.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, MFC42DEU.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.
/////////////////////////////////////////////////////////////////////////////
vc++Mfc示例题
需积分: 0 10 浏览量
更新于2010-04-01
收藏 14.85MB RAR 举报
**VC++ MFC 示例题详解**
MFC(Microsoft Foundation Classes)是微软开发的一个类库,它基于C++,为Windows应用程序提供了一套丰富的接口。VC++是微软的Visual C++集成开发环境,其中包含了对MFC的支持。MFC库简化了Windows API的使用,使得开发者能够更快速、更高效地构建Windows桌面应用程序。
本篇将深入探讨VC++ MFC的几个关键知识点,以及在实际编程中可能会遇到的示例题。
1. **MFC框架结构**
- MFC基于面向对象的设计,主要包含应用程序框架(CWinApp)、文档框架(CDocument)、视图框架(CView)和对话框框架(CDialog)等基本类。
- 应用程序框架CWinApp负责启动和退出应用程序,管理文档模板和注册表设置。
- 文档框架CDocument用于存储和处理数据,视图框架CView则负责显示和编辑文档。
- 对话框框架CDialog用于实现用户交互界面,可以包含各种控件,如按钮、文本框等。
2. **MFC消息处理机制**
- MFC使用消息映射机制,通过ON_MESSAGE、ON_COMMAND等宏将消息与函数关联起来,实现消息的分发和处理。
- 消息映射通常定义在派生自CWinApp、CDocument或CView的类中,通过BEGIN_MESSAGE_MAP和END_MESSAGE_MAP宏包裹。
3. **控件和用户界面**
- MFC提供了丰富的窗口控件,如按钮(CButton)、编辑框(CEdit)、列表框(CListBox)等,它们都是CWnd类的派生类。
- 使用DoDataExchange函数进行数据绑定,实现控件与成员变量的同步。
- 对话框资源在资源编辑器中设计,然后通过 OnInitDialog 初始化控件状态。
4. **文件操作**
- MFC提供了CFile类来处理文件读写操作,支持多种文件格式,如文本、二进制等。
- CDocument和CFile结合使用,可以方便地实现文件打开、保存、另存为等功能。
5. **数据库访问**
- MFC通过引入ADO(ActiveX Data Objects)或DAO(Data Access Objects)提供数据库访问功能。
- CRecordset类用于执行SQL查询并处理结果集,CDatabase类用于连接数据库。
6. **网络编程**
- MFC提供了MFC Socket类,可以用来实现简单的TCP/IP通信。
- CAsyncSocket类用于异步网络通信,而CSocket类则用于同步模式。
7. **图形绘制**
- CDC类代表设备上下文,用于在窗口或打印机上进行绘图操作。
- CBrush、CPen、CFont等类分别用于创建刷子、笔和字体,配合CDC进行图形绘制。
8. **异常处理**
- MFC提供了CException类作为所有异常的基类,可以捕获和处理运行时错误。
- 使用TRY、CATCH、THROW等宏进行异常处理。
9. **多线程编程**
- MFC支持多线程编程,CWinThread类是线程的基类。
- 创建线程时需要继承CWinThread,并重载Run函数,以实现线程的主体逻辑。
10. **打印和预览**
- MFC提供了CPrintInfo、CPreviewDC等类,用于实现打印和打印预览功能。
以上知识点是VC++ MFC开发中常见的基础概念和操作,通过理解和实践这些示例题,开发者可以更好地掌握MFC库的使用,从而编写出功能丰富的Windows应用程序。在学习过程中,建议动手实践每一个示例,理解其背后的原理和实现机制,这对于提升编程技能至关重要。
dalia123456
- 粉丝: 0
- 资源: 1
最新资源
- 毕设和企业适用springboot区域电商平台类及社交电商平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及3D建模平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及AI语音识别平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及城市智能运营平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及国际贸易平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及客户关系管理平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及个性化广告平台源码+论文+视频.zip
- 毕设和企业适用springboot区域电商平台类及团队协作平台源码+论文+视频.zip
- 毕设和企业适用springboot区域电商平台类及图书管理系统源码+论文+视频.zip
- 毕设和企业适用springboot区域电商平台类及文化旅游信息平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及企业创新研发平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及旅游数据平台源码+论文+视频.zip
- 毕设和企业适用springboot人工智能类及跨平台协作平台源码+论文+视频.zip
- 毕设和企业适用springboot社交平台类及在线系统源码+论文+视频.zip
- 毕设和企业适用springboot社交平台类及职业技能培训平台源码+论文+视频.zip
- 毕设和企业适用springboot社交平台类及运动管理平台源码+论文+视频.zip