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

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.

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.

- step 1


- step 2

- step 3


- step 4



- step 5


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



Ref
- Chapter 7: MFC's Document/View Architecture - MFC Internals
浙公网安备 33010602011771号