To use a registered message id, at the beginning of every cpp file that will
need the registered message id, such as the CMainFrame-derived class put:
static UINT NEAR WM_YOURWHATEVERCALLBACKMESSAGE =
RegisterWindowMessage("YourWhateverCallbackMessage");
Then you can use WM_YOURWHATEVERCALLBACKMESSAGE for a message id. The name
WM_YOURWHATEVERCALLBACKMESSAGE can be whatever name you want, of course.
To process the message, create a message map as in the following:
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
//}}AFX_MSG_MAP
ON_REGISTERED_MESSAGE(WM_YOURWHATEVERCALLBACKMESSAGE, OnWhateverCallbackMessage)
END_MESSAGE_MAP()
The following is a sample function for processing the message; it is just the
basics:
afx_msg LRESULT CMainFrame::OnWhateverCallbackMessage(WPARAM wParam, LPARAM lParam) {
return 0;
}
References
The following also describe registered messages: