Custom message in header files: #define wm_doubleClick WM_USER 1 // Defines a message Class CMYCLASS {... protected: AFX_MSG Void MyFunction (WPARAM WP, LPARAM LP); // Responding to the custom function of the message ...}; CPP file: BEGIN_MESSAGE_MAP (CInnerDlg, CDialog) // {{AFX_MSG_MAP (CInnerDlg) ...... //}} AFX_MSG_MAP ON_MESSAGE (WM_DOUBLECLICK, myfunction) // added to the message map to END_MESSAGE_MAP () .................. // Processing message mapping functions void CMYCLASS :: MyFunction (WPARAM WP, LPARAM LP) {
}
Send a message in other functions: CWnd :: PostMessage (WM_DOUBLECLICK, 0, 0); // Send a message CWnd :: SendMessage (wm_doubleclick, 0, 0); // Send a message