19. A brief introduction to the Key Technologies and notes of MFC

Source: Internet
Author: User

The book describes the implementation of rtti, dynamic creation, persistance, message mapping, and message routing. [1]

In particular, it is worth learning to establish a category-based record network.

1. MFC rules for message loops:

(1) if it is a common Windows message, it must flow from the derived class to the base class without going back.

(2) if it is a command message (wm_command), the path is very complex. The following summarizes the transmission of command messages.

The process in which MFC searches for corresponding message processing functions for command messages is: the command messages generated by user interface objects such as menus and toolbar are first sent to the Standard MFC Window Function of the main framework window; then, the Window Function transmits the command to the main framework window object of MFC, sends the command message, and matches the message according to the order in the table. If not, search for the message ing entry table of the base class. If not, search for the next object.

Retrieval path of table command messages

Program type

path

SDI (Single Document)

current view → current document → document template → main Framework Window → application object

MDI (Multi-document)

current view → current document → create document template → activity sub-Framework Window → main Framework Window → application object

dialog box

current dialog box → parent window of the dialog box → application object

If none of them are found, the default Windows message processing function ends the command message.

To improve message matching efficiency, MFC has a message buffer pool, which uses hash to search for messages, the pool can store information about 512 recently used message ing entry table items (note that you only need to add the entry table items, that is, two pointers ). The search process described above is performed only when it is not matched in the message buffer pool. [2]

Reference

[1] A Brief Introduction to MFC

[2] http://cc.seu.edu.cn/mm/cppsite/mfc/htms/kejian/07_2_6.htm

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.