xiaobin_hlj80

https://blog.csdn.net/xiaobin_HLJ80 http://blog.chinaunix.net/uid/31552151.html

导航

Create a single-document project using the MFC App Wizard in VC++ 5.0/6.0

  • Visual C++ 5.0/6.0
  • Windows 2003 R2
  • VirtualBox / VMware workstation

The Architecture

Supporting the coordination of application data and data renderings is a perfect job
for a framework. And when Microsoft released MFC 2.0 in early 1993, it included a document/view
architecture within MFC. MFC's document/view architecture deals with the data management and
User-Interface issues just described.

As an aside, MFC's document/view is not a new idea. It was first created by the folks at Xerox PARC (by the
same company that invented graphical user interface) and was a key part of ther Smalltalk environment.
Smalltalk's version of document/view is called model-view-controller(MVC)(where model=document). The Smalltalk
MVC architecture has a controller(kind of like CDocTemplate in MFC) that acts like a shield between the document
and the view so that they do not get too dependent on each other.

class diagram

mfc-base

Document/View

A document is a collection of data in your application with which the user interacts.

Although the word document seems to imply something of a textual nature, it isn’t limited to text.
It could be data for a game, a geometric model, a text file, or, indeed, anything you want.

The term document is just a convenient label for the application data in your program, treated as a unit.

object diagram

uses dashed arrows to show how pointers are used to relate objects. These pointers
enable function members of one object to access the public data or function members in the interface of another object.

figure12

project

name: SdiSquares
vc56: Images compatible with both VC 5.0 and VC 6.0
vc5/6: The left side is VC 5.0; the right side is VC 6.0.

new_project-vc6

  • step 1

mfc_app_wizard1a-vc5
mfc_app_wizard1a-vc6

  • step 2

mfc_app_wizard2a-vc56

  • step 3

mfc_app_wizard3a-vc5
mfc_app_wizard3a-vc6

  • step 4

mfc_app_wizard4a-vc5
mfc_app_wizard4a-vc6

mfc_app_wizard4a1-vc56

  • step 5

mfc_app_wizard5a-vc5
mfc_app_wizard5a-vc6

  • step 6
    modify class and file name:
CSquaresApp
CSquaresDoc
CSquaresView
SquaresDoc
SquaresView

mfc_app_wizard6a-vc56

mfc_app_wizard6b-vc56

mfc_app_wizard6c-vc12

Ref

  • Chapter 7: MFC's Document/View Architecture - MFC Internals

posted on 2026-09-26 08:01  xiaobin80  阅读(7)  评论(0)    收藏  举报