MFC Tutorials (5)--Creation of MFC objects (1)

Source: Internet
Author: User

The creation of MFC objects

The previous chapters introduce MFC's core concepts and ideas, that is, introduce MFC's encapsulation methods and features of Windows objects; Dynamic creation, serialization of MFC objects, and MFC message mapping mechanisms.

Now, examine MFC's application architecture, which is document-as the core programming model. To learn this chapter, you should clarify the following questions:

MFC relationships for many MFC objects: Application object, Document object, Border window object, Document Border Window object, object, document template object, and so on.

Creation and destruction of MFC objects: What objects Create or destroy what objects, when to create, and when to destroy?

What interfaces does MFC provide to support its programming mode?

The Relationship of MFC objects

Create a relationship

This discusses the creation relationships of applications, document templates, border Windows, visual, document, and so on. Figure 5-1 illustrates the order of creation, but table 5-1 shows more directly the relationship between creation and creation.

Table 5-1 MFC object Creation Relationship

Created by

The object being created

Application objects

Document templates

Document templates

Document

Document templates

Border window

Border window

As

Interactive relationships

The Application object has a list of document templates that holds one or more document template objects; The document template object has a list of open documents that holds one or more open document objects; The Document object has a view list that holds one or more objects that display the document's data ; There is also a pointer to the document template object that created the document; A pointer to its associated document is treated as a child window whose parent window is a border window (or a Document border window); A document border window has a pointer to its current active view; The document border window is a child of the border window.

Windows manages all windows that are already open and sends messages or events to the target window. Typically, a command message is sent to the main border window.

Figure 5-2 shows the above relationship in a very approximate way:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.