DECLARE_MESSAGE_MAP() BEGIN_MESSAGE_MAP(CtestDialogDlg, CDialogEx) ON_WM_PAINT() //OnPaint() ON_WM_QUERYDRAGICON() // ON_WM_SYSCOMMAND() //OnSysCommand() ON_WM_SIZE() //OnSize() ON_MESSAGE(WM_USER_MSG, &CtestDialogDlg::OnUserMsg) //自定义消息 ... END_MESSAGE_MAP()
A custom message:
1. The header file
#define WM_USER_MSG (of WM_USER +. 1)
afx_msg LRESULT OnUserMsg (WPARAM the wParam, LPARAM the lParam);
2. CPP file
BEGIN_MESSAGE_MAP (CtestDialogDlg, CDialogEx)
the ON_MESSAGE (WM_USER_MSG, & CtestDialogDlg :: OnUserMsg) // custom message
END_MESSAGE_MAP ()
afx_msg LRESULT CtestDialogDlg :: OnUserMsg (WPARAM the wParam, LPARAM the lParam)
{
....
return 0;
}