使用类编写 Windows 应用程序Using the Classes to Write Applications for Windows

同时,Microsoft 基础类 (MFC) 库中的类构成一个 "应用程序框架",您可以在其中为 Windows 操作系统生成应用程序。Taken together, the classes in the Microsoft Foundation Class (MFC) Library make up an "application framework," on which you build an application for the Windows operating system. 一般来说,框架定义了应用程序的主干,并提供可放置到主干上的标准用户界面实现。At a very general level, the framework defines the skeleton of an application and supplies standard user-interface implementations that can be placed onto the skeleton. 作为编程人员,您的工作就是填写主干的其余部分,这是特定于您的应用程序的内容。Your job as programmer is to fill in the rest of the skeleton, which are those things that are specific to your application. 您可以通过使用 MFC 应用程序向导为非常详尽的入门应用程序创建文件来开始使用。You can get a head start by using the MFC Application Wizard to create the files for a very thorough starter application. 使用 Microsoft Visual C++ 资源编辑器可直观地设计用户界面元素,类视图用于将这些元素连接到代码的命令,以及用于实现应用程序特定逻辑的类库。You use the Microsoft Visual C++ resource editors to design your user-interface elements visually, Class View commands to connect those elements to code, and the class library to implement your application-specific logic.

MFC framework 版本3.0 和更高版本支持 Win32 平台(包括 Microsoft Windows 95 和更高版本)和 Windows NT 版本3.51 及更高版本的编程。Version 3.0 and later of the MFC framework supports programming for Win32 platforms, including Microsoft Windows 95 and later, and Windows NT versions 3.51 and later. MFC Win32 支持包括多线程处理。MFC Win32 support includes multithreading. 如果需要进行16位编程,请使用版本 1.5 xUse version 1.5 x if you need to do 16-bit programming.

此系列文章提供了应用程序框架的广泛概述。This family of articles presents a broad overview of the application framework. 它还会探讨构成应用程序的主要对象及其创建方式。It also explores the major objects that make up your application and how they are created. 这些文章涉及的主题包括:Among the topics covered in these articles are the following:

框架的其他部分包括:Other parts of the framework include:

  • 窗口对象:概述Window Objects: Overview

  • 消息处理和映射Message handling and mapping

  • CObject,MFC 中的根基类CObject, The Root Base Class in MFC

  • 文档/视图体系结构Document/View Architecture

  • 对话框Dialog Boxes

  • 控件Controls

  • 控制条Control Bars

  • OLEOLE

  • 内存管理Memory Management

    除了为 Windows 操作系统编写应用程序提供优点之外,MFC 还可以更轻松地编写专门使用 OLE 链接和嵌入技术的应用程序。Besides giving you an advantage in writing applications for the Windows operating system, MFC also makes it much easier to write applications that specifically use OLE linking and embedding technology. 您可以使您的应用程序成为 OLE 可视化编辑容器和/或 OLE 可视编辑服务器,并且可以添加自动化,以便其他应用程序可以使用来自您的应用程序的对象,甚至可以通过远程方式驱动对象。You can make your application an OLE visual editing container, an OLE visual editing server, or both, and you can add Automation so that other applications can use objects from your application or even drive it remotely.

  • MFC ActiveX 控件MFC ActiveX Controls

    OLE control 开发工具包 (CDK) 现已与框架完全集成。The OLE control development kit (CDK) is now fully integrated with the framework. 本文系列提供 ActiveX 控件使用 MFC 进行开发的概述。This article family supplies an overview of ActiveX control development with MFC. (ActiveX 控件以前称为 OLE 控件。 ) (ActiveX controls were formerly known as OLE controls.)

  • 数据库编程Database Programming

    MFC 还提供了两组数据库类,它们可简化数据访问应用程序的编写。MFC also supplies two sets of database classes that simplify writing data-access applications. 使用 ODBC 数据库类,可以通过开放式数据库连接 (ODBC) 驱动程序连接到数据库,从表中选择记录,并在屏幕表单中显示记录信息。Using the ODBC database classes, you can connect to databases through an Open Database Connectivity (ODBC) driver, select records from tables, and display record information in an on-screen form. 使用 (DAO) 类的数据访问对象,可以通过 Microsoft Jet 数据库引擎或外部 (非 Jet) 数据源(包括 ODBC 数据源)来处理数据库。Using the Data Access Object (DAO) classes, you can work with databases through the Microsoft Jet database engine or external (non-Jet) data sources, including ODBC data sources.

    此外,MFC 完全启用用于编写使用 Unicode 和多字节字符集 (MBCS) 的应用程序,特别是双字节字符集 (DBCS) 。In addition, MFC is fully enabled for writing applications that use Unicode and multibyte character sets (MBCS), specifically double-byte character sets (DBCS).

有关 MFC 文档的一般指南,请参阅 常规 Mfc 主题For a general guide to MFC documentation, see General MFC Topics.

请参阅See also

常规 MFC 主题General MFC Topics