Command message transmission

Source: Internet
Author: User

On‑msg is a virtual function, and cframewnd overwrites this function. The current object (this refers to) is the border window object of the MFC single document. Therefore, the on1_msg of cframewnd is called. Cframewnd: on1_msg plays an important role in message sending of MFC. The default implementation of this function determines the Standard Life order sending path of MFC:

Send it to the active view and call the on1_msg of the activity view. Because the current object is an MFC object, ondomainmsg searches for the message ing array of the ctview and its base class to obtain the corresponding processing function.

If the object is not processed by itself, the associated document will be called on1_msg according to the associated document. Because the current object is an MFC object, ondomainmsg searches for the message ing array of ctdoc and its base class, and tries to obtain the corresponding processing function.

If the document object is not processed, it obtains the document template object for document management and calls the on1_msg of the document template. Because the current object is an MFC Document Template object, ondomainmsg searches for the message ing array of the document template class and its base class, and tries to obtain the corresponding processing function.

If the document template is not processed, the unprocessed information is returned step by step: the document template tells the document object, the Document Object tells the view object, and the view object tells the border window object. Finally, the border window shows that no message is processed by the view, document, or document template.

The on1_msg of cframewnd continues to call cwnd: on1_msg (Italics indicate class restrictions) to process messages. Since cwnd does not overwrite on1_msg, the function c1_target: on1_msg is actually called. Because the current object is an MFC border window object, the ondomainmsg function searches for the message ing array of the cmainframe class and all its base classes and tries to obtain the corresponding processing function. While cwnd does not implement on1_msg, it specifies to execute its on1_msg function. It can be used for other code that does not need to be changed after MFC implements on1_msg for cwnd.

In this step, the border window tries to process the message.

 

If the border window object is not processed, it is sent to the application object for processing. The on1_msg of the ctapp is called. Because the ctapp and its basic cwinapp do not actually overwrite on1_msg, the function c1_target: on1_msg is actually called. Because the current object is an MFC Application object, the on1_msg function searches for the message ing entry array of the ctapp class and all its base classes, and tries to obtain the corresponding processing function.

If the application object is not processed, false is returned, indicating that no command target is used to process the current command message. In this way, the function returns a level-by-level result. onjavasmsg tells oncommand that the message is not processed, oncommand tells onwndmsg that the message is not processed, and onwndmsg tells windowproc that the message is not processed. Therefore, windowproc calls defwindowproc.

Command message transmission

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.