MFC message ing mechanism

Source: Internet
Author: User
Zookeeper

MFC message ing mechanism:

In each class that can receive and process messages, define a ing table between messages and message processing functions, that is, the message ing table. MFC has a window handle ing table with the c ++ Object Pointer. When the window receives a message, the first parameter of the message specifies the window handle associated with the message, find the C ++ Object Pointer through the ing table, and pass the pointer to the base class of the window class of the application framework. The base class calls the windowproc function (in wincore. CPP file). This is a virtual function. The function calls the onwndmsg function internally. Message Processing is completed in this function, and this function is also in wincore. CPP. The onwndmsg function first checks whether there is a message Response Function in the window class. First, check the declare_message_map () macro in the header file of the subclass and whether there is a declaration of the prototype of the message response function between the two afx_msg comment macros; then, in the subclass source file, check whether there is a message ing macro between in_message_map and end_message_map (). Find the message Response Function and process the message. If not, then it is handed over to the base class for processing.

MFC message ing mechanism

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.