VisualCMFC简要介绍(外文翻译

合集下载

Visual C++程序设计(中英文翻译)

Visual C++程序设计(中英文翻译)

附录二外文翻译Fundamentals of Programming Visual C++The 21st century are the information societies, unceasingly grow take the information technology as the main symbol high-tech industry in the entire economical proportion, along with the computer technology rapid development, the society also day by day enhance to talented person's computer application and the development level request, are the adaption situations, VC++ technology and its the product are a huge domain which now the world computer develops. Windows 2000/xp is the present mainstream graph operating system, moves the various Windows operating system personal computer already in the global family and the work environment the widespread use, but more and more many personal computer had the Internet function and the multimedia function impel to be strong to various function, speed quick application software further demand. At present has one kind the success which obtains to Microsoft to carry on the slander the atmosphere, however, the Microsoft success adds on it to the standardized pledge, the technology which enables to have the Windows programmers which pledge uses them to grasp in the global scope to obtain the more and more big repayment, because the western society's acknowledgment and the computer more and more penetrated into in each person's life, thus grows day by day to their technical demand, thus caused them the repayment, the income and other various aspects correspondingly has obtained the satisfactory result.Visual the C++ programming language is at present extremely widespread visible development kit which promotes by Microsoft Corporation, may develop using Visual C++ based on the Windows platform 32 applications procedure, depends upon the formidable compiler as well as the network and the database development ability, may develop the function formidable application procedure with Visual C++.VC++6.0 is in the operating system the rapid application development environment newest edition. It also is in the current Windows platform the first comprehensive support newest Web service fast development kit. Regardless of is the enterprise level user, or individual development, all can be relaxed using VC++6.0, quickly develop outstandingly based on the correspondence procedure, the development highly effective nimble document operation sequence, the development nimble highly effective database operation sequence, and so on. VC++6.0 is the industry standard RAD environment which the only support all newly appears, (expansion mark language) /XSL (may expand style language) including XML, SOAP (simple object deposit and withdrawal agreement) and WSDL (Web server description language) and so on.VC++6.0 is the visible fast application procedure development language, it has provided thevisible integrated development environment, this environment has provided a series of nimble and the advanced tool for the application programming personnel, may widely use in the type application programming. In the VC++6.0 integrated development environment, the user may design the procedure code, the operating procedure, carries on the program error the debugging and so on, the visible method of exploitation reduced the application procedure development difficulty. The VC++6.0 foundation programming language has the object-oriented characteristic C++ language. C++ has the code stably, the readability good, the translation speed is quick, the efficiency higher merit, and the object-oriented concept will obtain the full display, enable this language to have the brand-new development space Uses VC++6.0 , we nearly may handle any matter, but also may compose plants each kind of type the application procedure, dynamic link storehouse (DLL), CON, or CORBA object, CGI/ISAPI procedure, Microsoft Back Office application procedure. The procedure scale to the simple individual database application, is slightly big to the complex enterprise's multi-level distributional system, all may use VC++6.0 to carry on the development, its friendly integrated development contact surface, the visible bidirectional development pattern, the good database application support highly effective procedure development and the procedure movement, prepares the general procedures development personnel's high praise. VC++6.0 to the database application formidable support, greatly enhanced the efficiency in particular which the database application software develops, reduced the development cycle, deeply general databases application programming personnel's affection. VC++6.0 was the database has provided the rich database development module using the development personnel, caused the database application development function formidable, control more nimble, after the translation procedure running rate was quicker.In 6.0 has contained the massive new functions in Visual C++: Some new controls (for example, you possibly email application procedure date selector control in Microsoft in Outlook) at present to be able to apply in you application procedure. Each kind of image could now be connected with the combination frame in item, moreover may use the combination frame which expands to control and following tabulates the pictorial display in the combination choice frame. The tool strip 97 and Internet Explorer in 4 which has used the common tool strip and the size may adjust which in Office all to integrate in its kind of storehouse, by uses in you application procedure for you. You may use Internet Explorer in you application procedure, examines the Web page and the HTML content .The object-oriented system structure technology is helpful to the foundation professional software development organization. For example ,transportation plan although has the difference, but various cities need software basically is same, this provided one kind of manufacture for the software development organization (to pay attention to here lecture face the transportation plan software frame is software frame but was not versatile software) an opportunity. This kind of frame once develops successfully, may repeatedly use many times.The thinking mode decided solves the question way, the traditional software development uses the from the top thought instruction programming, soon the goal divides into certainsubtargets, the subtarget further divides again, can program until the goal the realization. The object-oriented technology brings the enormous change for the software design domain, it carries on the procedure development using the software object, the so-called object is contains the data and the logarithm according to the operation code entity, or said is joins some in the traditional construction of data to be called the member function the process, thus entrusts with the object by the movement. But in the programming, the object has with the real world some kind of corresponding relations, we are precisely use this kind of relations to carry on the decomposition to the question.BMP is the bitmap abbreviation, namely for position chart picture. The position chart picture is called as "the picture element" with one kind the unit storage picture information. These "the picture element" actually is some neat arrangements colored (or black and white) the spot, if these is slowly enlarged, you can see center adds to one each one "the picture element" is imitating own color, these "the picture element" neatly arranges, has become a BMP picture, and take bmp (rle, dib and so on) as the extension. BMP (Bitmap-File) the graphic file is the graphic file form which Windows uses, moves all imagery processing software under the Windows environment all to support the BMP image document format. BMP: The Windows position chart may (as black and white use any color depth from as 24 colors) to save the single diffraction grating picture. The Windows position chart document format and other Microsoft the Windows procedure is compatible. Its supporting documentation compression, also ill uses in the Web page.Looked from the overall that, the Windows position chart document format shortcoming has surpassed its merit. In order to guarantee the picture picture the quality, please use the PNG document, the JPEG document or the TIFF document. The BMP document is suitable in Windows the wallpaper. Merit: BMP supports 1 to 24 colors depths. The BMP form and the existing Windows procedure (an older procedure) widespread is in particular compatible. Shortcoming: BMP does not support the compression, this can create the document to be extremely big. BMP document not Web browser support.The computer technology rapid development time, the picture document has the vital role one of as transmission information important methods. Each kind of picture form all has own characteristic and the application domain, each kind of picture document through the format conversion software realization mutual transformation, the user acts according to own demand choice appropriate form to achieve the best use effect.The development and the popularization which along with computer software, the hardware technology changes with each new day, the humanity already entered a high speed development the information time, the humanity probably has 80% information to come from the picture, in the scientific research, the technical application the picture processing technology more and more to become the essential method. Picture processing involves the domain has the military application, medicine diagnosis, industry monitoring, the object automatic minute examines recognition system and so on, these systems need the computer to provide the real-time tendencyall, the effect lifelike picture.What Is Microsoft Visual C++?C++ emerged in the 1980s as an object-oriented extension of the C programming language. Object orientation made code easier to reuse and solutions became easier to segment so that multiple programmers can work simultaneously on projects. Visual C++, developed by Microsoft, takes the C++ language and adds a Windows-based Integrated Development Environment (IDE) and a set of classes, called Microsoft Foundation Classes (MFC), which allow C++ developers to manipulate elements in the Windows operating systemObject-Oriented Programming•While procedural languages organize code as a list of tasks to be carried out by the processor in a particular order, object-oriented languages like C++ organize code into distinct objects, each having its own properties and methods. One advantage of object-oriented programming is that it allows code that can describe real world objects. A BankAccount object, for instance, could have properties of "Balance" and "AccountHolder" and could include methods of "Deposit" and "Withdraw."Microsoft Foundation Classes•The Microsoft Foundation Classes are at the center of Visual C++ programming for Windows. The MFC is a group of objects and methods that allow the programmer to manipulate the Windows environment (opening and closing windows, drawing content within windows, creating menus) and to react to a Windows user's input (mouse clicks, mouse movement, key presses, menu selections). Because most of Windows programming is centered around reaction to user inputs through the Windows user interface, it is said to be "event-driven." Much of the MFC simply gives programmers ways of hooking in to Windows-initiated events.The Integrated Development Environment•C++, like most other programming languages, can be written out as text in a simple text editor. The text can then be "compiled" (turned into binary code) by a command-line initiated process. The introduction of Integrated Development Environments allows developers to navigate their code much more efficiently through menus that will take them to specific objects and methods. Other features of the Visual C++ and Visual Studio development environments include auto complete, which aids in typing code, visual design, which allow graphical elements of a program to be generated through drag and drop, and test suites for testing processes within an application.C++ Versus other Languages•Programmers often debate what the best language and tools are for a given project and task. Compared to other object-oriented languages such as Java, C#, objective C or Python, C++ is usually considered the most difficult to learn and time-consuming to code, but will, in the right hands, result in the best performing application. Such claims, however, are often disputed.Introduce VCVisual C++ (also known as MSVC or VC) is an Integrated Development Environment (IDE)product for the C and C++ programming languages engineered by Microsoft. It has tools for developing and debugging C++ code, especially that written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework.Visual C++ 6.0 which includes MFC 6.0 (released in 1998) was (and still is) widely used tool for large and small projectsVisual C++ .NET 2002 which includes MFC 7.0 (known also as Visual C++ 7.0) was released in 2002 with support for link time code generation, debugging runtime checks, and included managed extension to the C++ language. It also included a new user interface (shared with Visual Basic and Visual C#), which is a primary reason why Visual C++ 6.0 is still in wide use. Visual C++ .NET 2003 which includes MFC 7.1 (known also as Visual C++ 7.1) was released in 2003 and was a major upgrade to Visual C++ .NET 2002.Visual C++ .NET 2005 which will include MFC 8.0(known also as Visual C++ 8.0) will be released in Nov 2005 and will be a major upgrade to Visual C++ .NET 2003.The .NET Framework created by Microsoft is a software development platform focused on rapid application development (RAD), platform independence and network transparency. .NET is Microsoft's strategic initiative for server and desktop development for the next decade. According to Microsoft, .NET includes many technologies that are designed to facilitate rapid development of Internet and intranet applications..NET has brought new functionalities and tools to the application programming interface (API). These innovations allow programmers to develop applications for both Windows and the web as well as components and services (web services). .NET provides a new reflective, object-oriented API. .NET is designed to be sufficiently generic that many different high-level languages can be compiled.The .NET framework is a competing product to Sun's Java and J2EE technology and it shares many concepts with it.There is a collection of development tools specifically developed for use with the .NET platform. The principal example is Visual Studio .NET, an integrated development environment from Microsoft.Microsoft Visual C++ 2005 provides a powerful and flexible development environment for creating Microsoft Windows–based and Microsoft .NET–based applications. It can be used as an integrated development system, or as a set of individual tools. Visual C++ is comprised of these components:The Visual C++ 2005 compiler tools. The compiler has new features supporting developers that target virtual machine platforms like the Common Language Runtime (CLR). There are now compilers to target x64 and Itanium. The compiler continues to support targeting x86 machines directly, and optimizes performance for both platforms.The Visual C++ 2005 Libraries. This includes the industry-standard Active Template Library (ATL), the Microsoft Foundation Class (MFC) libraries, and standard libraries such as the Standard C++ Library, and the C RunTime Library (CRT), which has been extended toprovide security enhanced alternatives to functions known to pose security issues. A new library, the C++ Support Library, is designed to simplify programs that target the CLR.The Visual C++ 2005 Development Environment. Although the C++ compiler tools and libraries can be used from the command-line, the development environment provides powerful support for project management and configuration (including better support for large projects), source code editing, source code browsing, and debugging tools. This environment also supports IntelliSense, which makes informed, context-sensitive suggestions as code is being authored.In addition to conventional graphical user-interface applications, Visual C++ enables developers to build Web applications, smart-client Windows-based applications, and solutions for thin-client and smart-client mobile devices. C++ is the world's most popular systems-level language, and Visual C++ gives developers a world-class tool with which to build software.Visual C++程序设计21世纪将是信息化社会,以信息技术为主要标志的高新技术产业在整个经济中的比重不断增长,随着计算机技术的飞速发展,社会对人才的计算机应用与开发水平的要求也日益增高,为适应形式,其中VC++技术及其产品是当今世界计算机发展的一块巨大领域。

VC03 MFC概述

VC03 MFC概述

5.1 MFC概述微软基本类库MFC(Microsoft Foundation Class)是微软公司为Windows程序员提供的一个面向对象的Windows编程接口,它大大简化了Windows编程工作。

使用MFC类库进行Windows应用程序开发具有很大的优越性。

首先,MFC提供了一个标准化的结构,这样,开发人员不必从头设计创建和管理一个标准Windows应用程序所需的程序,而是“站在巨人肩膀上”,从一个比较高的起点编程,因而节省了大量的时间;其次,它提供了大量现成的代码,并通过向导(应用程序向导AppWizard和类向导ClassWizard)指导用户编程时实现某些技术和功能。

MFC类库充分利用了Microsoft开发人员多年开发Windows程序的经验,并可以将这些经验融入到你自己开发的应用程序中去。

对用户来说,用MFC开发的最终应用程序具有标准的、熟悉的Windows界面,这样的应用程序易学易用;另外,新的应用程序还能立即支持所有标准Windows特性,而且是用普通的、明确定义的形式。

事实上,也就是在Windows应用程序界面基础上定义了一种新的标准——MFC标准。

早期,在开发Windows应用程序时必须使用微软的SDK,直接调用Windows API函数。

由于Windows API的数目非常多,编写Windows应用程序不仅需要记住很多API函数,而且要小心谨慎地处理程序中的每一个细节。

MFC按照面向对象的原理把这些浩繁的Windows API按逻辑组织起来,使它们具备了抽象化、封装、多态性和模块化的性质。

1989年,微软建立了Application Framework(AFX)小组,负责开发和Borland公司的应用程序框架OWL(Object Windows Language)相类似的应用程序框架。

OWL是Borland 公司为Windows程序员开发的一个类库,在当时非常成功。

AFX小组最初的目标是利用最新的面向对象的技术来开发用于编写Windows GUI程序的工具和类库。

MFC使用教程范文

MFC使用教程范文

MFC使用教程范文MFC(Microsoft Foundation Classes)是微软的一套C++类库,用于开发Windows桌面应用程序。

本教程将向您介绍MFC的基本概念和使用方法。

一、MFC简介MFC是基于面向对象的设计思想,为开发Windows应用程序提供了一套强大的工具和框架。

它提供了诸如窗口、对话框、菜单等常见界面元素的类,并且封装了底层的Windows API,简化了程序的编写过程。

二、MFC应用程序的创建要创建一个MFC应用程序,您可以使用Visual Studio进行操作。

首先,打开Visual Studio,并选择“新建项目”,然后选择“MFC应用程序”模板。

在创建项目的向导中,您可以指定应用程序的名称、位置和其他选项。

接下来,您可以选择所需的特性和模板。

例如,如果需要创建一个对话框应用程序,则可以选择“对话框”模板。

创建完成后,Visual Studio将自动为您生成一个基本的MFC应用程序框架,包括一个主窗口、一个菜单栏、一个工具栏和一个状态栏。

三、MFC界面元素的创建和使用1. 窗口(CWnd类):MFC提供了多种窗口类,如CFrameWnd、CView 等,您可以根据需要选择合适的窗口类来创建窗口。

4. 菜单(CMenu类):MFC通过CMenu类来管理菜单。

您可以创建菜单项并将其添加到菜单中,然后将菜单与窗口相关联。

5. 工具栏(CToolBar类):工具栏是一种常见的界面元素,用于提供快速访问常用命令的按钮。

您可以通过CToolBar类创建和管理工具栏,并将其与窗口相关联。

四、MFC消息机制在MFC中,程序通过消息来进行事件处理。

消息是由操作系统发送给应用程序的,应用程序通过重载消息响应函数来处理不同类型的消息。

在MFC中,您可以通过添加消息映射宏(BEGIN_MESSAGE_MAP和END_MESSAGE_MAP)和消息处理函数(OnXxx系列函数)来处理消息。

3 MFC简介

3 MFC简介

MFC简介问题1:什么是MFC?一个优秀的编程工具往往匹配一个功能强大的类库,类库封装了大量Windows编程需要使用的函数和数据结构。

与Visual C++捆绑在一起的MFC(Microsoft Foundation Class)微软基础类就是这样一个由Microsoft公司设计的类库。

问题2:什么叫类库?类库是一个可以在应用程序中使用的相互关联的C++类的集合。

MFC作为一个Windows编程类库,它包含了200多个类,封装了Windows的大部分编程对象以及与它们有关的操作。

问题3:使用MFC有什么好处?虽然程序在功能上千差万别,但从本质上看,都可以分为用户界面设计、文件操作、数据库访问及多媒体使用等几部分,这些都可以通过一些类来实现。

MFC提供了一个标准化的程序结构,使开发人员不必从头设计一个Windows应用程序。

MFC实际上是一个庞大的文件库,它由几百个执行文件和源代码文件(如H文件)组成。

前面的几个例子,我们利用Windows API开发程序,即使开发一个简单的Windows应用程序也需要对Windows的编程原理有很深刻的认识,需要手工编写冗长的代码。

由于程序的出错率是随着代码长度的增加呈几何级数增长的,而且当程序长度逐渐膨胀时,调试程序会变得越来越困难。

因此,传统的Windows应用程序设计需要程序员有极大的耐心和丰富的编程经验。

因为Visual C++捆绑了微软的基础类MFC,所以编程时我们就可以利用类的可重用性和可扩充性,大大降低Windows应用程序设计的难度和工作量。

具体地说,使用MFC编程有以下的优点:1.使用标准化的程序代码结构,有利于程序员之间的交流。

2.Visual C++为MFC提供了大量的工具支持,提高了编程效率.如利用MFC AppWizard创建MFC应用程序框架,利用ClassWizard方便地对Windows消息进行管理。

3. MFC应用程序的效率较高,只比传统的Windows C程序低5%左右。

Visual C++ MFC 简明教程

Visual C++ MFC 简明教程

Visual C++ MFC 简明教程原著:Marshall Brain 编译:张圣华第一部分 MFC导论 (2)第一章什么是MFC (2)第二章WINDOWS词汇 (2)第三章建立项目和编译代码 (6)第二部分一个简单的MFC程序 (8)第一章MFC简介 (8)第二章设计一个程序 (9)第三章理解“hello world”的代码 (10)第四章程序对象 (11)第五章窗口对象 (12)第六章静态文本控制 (14)第三部分:MFC样式 (15)第一章基础 (15)第一节CStatic样式 (15)第二节CStatic文本的外观 (16)第三节CStatic的矩形显示模式 (19)第四节字体 (19)第二章查看Microsoft文档中的函数 (21)第三章编译多个可执行程序 (21)第四部分:消息映射 (20)第一章理解消息映射 (21)第二章CButton类 (21)第三章建立消息映射 (23)第四章改变大小的消息 (25)第五章窗口消息 (27)第六章滚动条控制 (29)第七章理解消息映射 (32)第一部分:MFC导论V isual C++ 不仅仅是一个编译器。

它是一个全面的应用程序开发环境,使用它你充分利用具有面向对象特性的C++ 来开发出专业级的Windows 应用程序。

为了能充分利用这些特性,你必须理解C++ 程序设计语言。

掌握了C++,你就必须掌握Microsoft 基本类库(MFC) 的层次结构。

该层次结构包容了Windows API 中的用户界面部分,并使你能够很容易地以面向对象的方式建立Windows 应用程序。

这种层次结构适用于所有版本的Windows 并彼此兼容。

你用MFC 所建立的代码是完全可移植的。

该教程将向你介绍MFC的基本概念和术语以及事件驱动程序设计方法。

在本节中,你将会输入、编译和运行一个简单的MFC程序。

下一节中将向你详细解释这些代码。

第三部分讨论了MFC控制和如何定制它们。

mfc使用手册

mfc使用手册

mfc使用手册MFC(Microsoft Foundation Class Library)是微软提供的一个类库,用于简化Windows应用程序的开发过程。

以下是MFC使用手册的简要介绍:1. 简介:MFC是一个基于C++的类库,它提供了许多用于构建Windows应用程序的类和函数。

通过使用MFC,开发人员可以快速地构建具有一致外观和感觉的应用程序,并利用Windows平台提供的各种功能。

2. 安装和配置:在开始使用MFC之前,您需要安装Microsoft Visual Studio并确保安装了MFC开发工作负载。

安装完成后,您需要创建一个新的MFC项目或打开一个现有的MFC项目。

3. 创建MFC应用程序:要创建一个新的MFC应用程序,您需要使用Microsoft Visual Studio的向导。

选择“File”菜单中的“New”选项,然后选择“Project”。

在弹出的对话框中,选择“MFC Application”并按照向导的提示完成应用程序的创建过程。

4. MFC类库:MFC提供了许多用于构建应用程序的类和函数。

以下是一些常用的MFC类:CWinApp:应用程序对象类,用于管理应用程序级别的操作,例如初始化应用程序和退出应用程序。

CWnd:窗口类,用于管理窗口的各种操作,例如创建窗口、处理消息和绘制窗口。

CDocument:文档类,用于管理应用程序中的文档数据。

CView:视图类,用于管理应用程序中的视图,例如显示文档数据和与用户交互。

5. MFC消息处理:MFC使用消息传递机制来处理用户与应用程序的交互。

每个窗口和控件都处理一组预定义的消息,例如鼠标点击、键盘输入和窗口大小改变等。

通过覆盖类中的虚函数,您可以定义应用程序如何响应这些消息。

6. MFC对话框和控件:MFC提供了许多内置的对话框和控件,例如按钮、文本框和列表框等。

您可以使用对话框编辑器来创建对话框,并将控件拖放到对话框中。

vc mfc

vc mfc

什么是MFC?MFC——微软基础类(Microsoft Foundation Classes),同VCL类似,是一种Application Framework,随微软Visual C++ 开发工具发布。

目前最新版本为9.0(截止2008年11月)。

该类库提供一组通用的可重用的类库供开发人员使用。

大部分类均从CObject 直接或间接派生,只有少部分类例外。

MFC 应用程序的总体结构通常由由开发人员从MFC类派生的几个类和一个CWinApp类对象(应用程序对象)组成。

MFC 提供了MFC AppWizard 自动生成框架。

Windows 应用程序中,MFC 的主包含文件为"Afxwin.h"。

此外MFC 的部分类为MFC/ATL 通用,可以在Win32 应用程序中单独包含并使用这些类。

由于它的易用性,初学者常误认为VC++开发必须使用MFC。

这种想法是错误的。

作为Application Framework,MFC 的使用只能提高某些情况下的开发效率,只起到辅助作用,而不能替代整个Win32 程序设计。

MFC,微软基础类(Microsoft Foundation Classes),实际上是微软提供的 ,用于在C++环境下编写应用程序的一个框架和引擎,VC++是WinDOS下开发人员使用的专业C++ SDK(SDK,Standard SoftWare Develop Kit,专业软件开发平台), MFC就是挂在它之上的一个辅助软件开发包,MFC作为与VC++血肉相连的部分(注意C++和VC++ 的区别:C++是一种程序设计语言,是一种大家都承认的软件编制的通用规范,而VC++只是一个编译器,或者说是一种编译器+源程序编辑器的 IDE,WS,PlatForm,这跟Pascal和Delphi 的关系一个道理,Pascal是Delphi 的语言基础,Delphi使用Pascal规范来进行Win 下应用程序的开发和编译,却不同于Basic语言和VB 的关系,Basic语言在VB开发出来被应用的年代已经成了Basic语言的新规范,VB新加的 Basic语言要素,如面向对象程序设计的要素,是一种性质上的飞跃,使VB既是一个IDE,又成长成一个新的程序设计语言),MFC同BC++集成的 VCL一样是一个非外挂式的软件包,类库,只不过MFC类是微软为VC++专配的。

MFC概述

MFC概述

一、MFC1、何为MFC:MFC(Microsoft Foundation Class,微软基础类库)是微软为了简化程序员的开发工作所开发的一套C++类的集合,是一套面向对象的函数库,以类的方式提供给用户使用。

MFC库是开发Windows应用程序的C++接口。

提示:在MFC中,类的命名都以字母C开头。

若要查看某个类或函数的帮助,可以把当前光标放在该类或函数所在位置,然后按F1键,即可打开MSDN中相应帮助。

2、MFC默认创建的App类:对MFC程序来说,通过产生一个应用程序类的对象来唯一标识应用程序的实例,每个MFC程序有且仅有一个CWinApp类派生类(名字为”CMFC工程名App”)的实例化对象,也就是theApp全局对象,该对象表示了应用程序本身。

3、MFC中Afx前缀的函数:Afx前缀的函数代表应用程序框架(Application Framew)函数。

应用程序框架实际上是一套辅助我们生成应用程序的框架模型。

该模型把多个类进行了一个有机的集成,可以根据该模型提供的方案来设计我们自己的应用程序。

在MFC中,以Afx 为前缀的函数都是全局函数,可以在程序的任何地方调用它们。

提示:“::”开始的表示方法用于调用一个全局函数。

如:“::ShowWindow(m_hWnd,nCmdShow)”4、MFC的系统源文件的位置:MFC的系统源文件一般在VC安装目录下的\VC98\MFC\SRC 中,如:C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC。

提示:在当前工程文件中查找某个字符串,可用工具栏上的”Find in Files”工具按钮或Edit 菜单下的Find in Files命令;若在当前文件中查找某个字符串,可用Ctrl+F快捷键或Edit 菜单下的Find命令。

5、MFC中后缀名为Ex的函数都是扩展函数。

6、MFC创建的Frame和View类所代表的窗口:提示:视图类(View类)窗口始终覆盖在框架类(Frame类)窗口之上。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Introduction to MFC Programming with Visual C++ Version 6.xby Marshall BrainVisual C++ is much more than a compiler. It is a complete application development environment that, when used as intended, lets you fully exploit the object oriented nature of C++ to create professional Windows applications. In order to take advantage of these features, you need to understand the C++ programming language. If you have never used C++, please turn to the C++ tutorials in the C/C++ Tutorials page for an introduction. You must then understand the Microsoft Foundation Class (MFC) hierarchy. This class hierarchy encapsulates the user interface portion of the Windows API, and makes it significantly easier to create Windows applications in an object oriented way. This hierarchy is available for and compatible with all versions of Windows. The code you create in MFC is extremely portable.These tutorials introduce the fundamental concepts and vocabulary behind MFC and event driven programming. In this tutorial you will enter, compile, and run a simple MFC program using Visual C++. Tutotial 2 provides a detailed explanation of the code used in Tutorial 1. Tutorial 3 discusses MFC controls and their customization. Tutorial 4 covers message maps, which let you handle events in MFC.What is the Microsoft Foundations Class LibraryLet's say you want to create a Windows application. You might, for example, need to create a specialized text or drawing editor, or a program that finds files on a large hard disk, or an application that lets a user visualize the interrelationships in a big data set. Where do you beginA good starting place is the design of the user interface. First, decide what the user should be able to do with the program and then pick a set of user interface objects accordingly. The Windows user interface has a number of standard controls, such as buttons, menus, scroll bars, and lists, that are already familiar to Windows users. With this in mind, the programmer must choose a set of controls and decide how they should be arranged on screen. A time-honored procedure is to make a rough sketch of the proposed user interface (by tradition on a napkin or the back of an envelope) and play with the elements until they feel right. For small projects, or for the early prototyping phase of a larger project, this is sufficient.The next step is to implement the code. When creating a program for any Windowsplatform, the programmer has two choices: C or C++. With C, the programmer codes at the level of the Windows Application Program Interface (API). This interface consists of a collection of hundreds of C functions described in the Window's API Reference books. For Window's NT, the API is typically referred to as the "Win32 API," to distinguish it from the original 16-bit API of lower-level Windows products like Windows 3.1.Microsoft also provides a C++ library that sits on top of any of the Windows APIs and makes the programmer's job easier. Called the Microsoft Foundation Class library (MFC), this library's primary advantage is efficiency. It greatly reduces the amount of code that must be written to create a Windows program. It also provides all the advantages normally found in C++ programming, such as inheritance and encapsulation. MFC is portable, so that, for example, code created under Windows 3.1 can move to Windows NT or Windows 95 very easily. MFC is therefore the preferred method for developing Windows applications and will be used throughout these tutorials.When you use MFC, you write code that creates the necessary user interface controls and customizes their appearance. You also write code that responds when the user manipulates these controls. For example, if the user clicks a button, you want to have code in place that responds appropriately. It is this sort of event-handling code that will form the bulk of any application. Once the application responds correctly to all of the available controls, it is finished.You can see from this discussion that the creation of a Windows program is a straightforward process when using MFC. The goal of these tutorials is to fill in the details and to show the techniques you can use to create professional applications as quickly as possible. The Visual C++ application development environment is specifically tuned to MFC, so by learning MFC and Visual C++ together you can significantly increase your power as an application developer.Windows V ocabularyThe vocabulary used to talk about user interface features and software development in Windows is basic but unique. Here we review a few definitions to make discussion easier for those who are new to the environment.Windows applications use several standard user controls:Static text labelsPush buttonsList boxesCombo boxes (a more advanced form of list)Radio boxesCheck boxesEditable text areas (single and multi-line)Scroll barsYou can create these controls either in code or through a "resource editor" that can create dialogs and the controls inside of them. In this set of tutorials we will examine how to create them in code. See the tutorials on the AppWizard and ClassWizard for an introduction to the resource editor for dialogs.Windows supports several types of application windows. A typical application will live inside a "frame window". A frame window is a fully featured main window that the user can re-size, minimize, maximize to fill the screen, and so on. Windows also supports two types of dialog boxes: modal and modeless. A modal dialog box, once on the screen, blocks input to the rest of the application until it is answered. A modeless dialog box can appear at the same time as the application and seems to "float above" it to keep from being overlaid.Most simple Windows applications use a Single Document Interface, or SDI, frame. The Clock, PIF editor, and Notepad are examples of SDI applications. Windows also provides an organizing scheme called the Multiple Document Interface, or MDI for more complicated applications. The MDI system allows the user to view multiple documents at the same time within a single instance of an application. For example, a text editor might allow the user to open multiple files simultaneously. When implemented with MDI, the application presents a large application window that can hold multiple sub-windows, each containing a document. The single main menu is held by the main application window and it applies to the top-most window held within the MDI frame. Individual windows can be iconified or expanded as desired within the MDI frame, or the entire MDI frame can be minimized into a single icon on the desktop. The MDI interface gives the impression of a second desktop out on the desktop, and it goes a long way towards organizing and removing window clutter. Each application that you create will use its own unique set of controls, its own menu structure, and its own dialog boxes. A great deal of the effort that goes into creating any good application interface lies in the choice and organization of these interface objects. Visual C++, along with its resource editors, makes the creation and。

相关文档
最新文档