"Go" VC custom message

Source: Internet
Author: User

MFC can generally use the ClassWizard Class Wizard to add message and message processing functions, but the user-defined message must be entered manually, now the VC custom message method steps are recorded as follows:

(1) Define a message that uses the # define statement to define the user's own message directly (either in the. h file or in the. cpp file) as follows:

#define Wm_mymessage wm_user+1

(2) Declare the custom message handler function in the. h file as follows:

afx_msg LRESULT onmymessage (WPARAM wp,lparam LP);
and add in the function body declaration of the class

Public:
LRESULT c***::onmymessage (WPARAM wp,lparam LP);

(3) Add a custom message map macro in the. cpp file and add it in the middle of Begin_message_map () and End_message_map ():

On_message (wm_memessage,onmymessage)//Custom message map macros

(4) Continue implementing the OnMyMessage () function in. cpp and add the following code:

LRESULT c***::onmymessage (WPARAM wp,lparam LP)
{

Code to implement function functions

}

Reference: http://www.cnblogs.com/514687800/archive/2013/04/25/3043568.html

"Go" VC custom message

Related Article

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.