On_message responds to custom messages, see the following steps for handling custom messages:
1. Define the message:
#define add Customize declaration to header file: afx_msg LRESULT Customize (WPARAM WPARAM, LPARAM LPARAM);
Registering the message in the 2.cpp file
On_message (Wm_customize, CUSTOMIZE)
3. Adding a message response function implementation
In the implementation file of the Ccdlg class, add the implementation part of the message response function, the code is as follows:
void ccdlg::customize (WPARAM WPARAM, LPARAM LPARAM) { CString strtittle; Strtittle.format (" Custom message parameters: x=%d,y=%d", Wparam,lparam); SetWindowText (Strtittle); }
4. Explicitly send a message:
Add the "Custom Message" submenu to the main frame's help main menu, whose ID is set to id_customize, and the function name defaults by using the Class Wizard to respond to the command. The function body is as follows:
void cmainframe::oncustomize () {point pos; // getcursorpos (&POS); Pdlg-SendMessage (Wm_customize, (UINT) pos.x,pos.y);}
from:http://blog.163.com/zy_tommy/blog/static/869267772010222851391/
"Go" on_message use method