RESOLUTION
Make sure your message handlers for ON_MESSAGE(), ON_REGISTERED_MESSAGE(),
ON_THREAD_MESSAGE(), and ON_REGISTERED_THREAD_MESSAGE() have the correct
signatures.
The correct signature for ON_MESSAGE() is:
afx_msg LRESULT OnMyMsg(WPARAM, LPARAM)
The correct signature for ON_REGISTERED_MESSAGE is:
afx_msg LRESULT OnMyRegisteredMsg(WPARAM, LPARAM)
The correct signature for ON_THREAD_MESSAGE is:
afx_msg void OnMyThreadMsg(WPARAM, LPARAM)
The correct signature for ON_REGISTERED_THREAD_MESSAGE is:
afx_msg void OnMyRegisteredThreadMsg(WPARAM, LPARAM)
For signatures for other versions of Visual C++, please consult help for
ON_MESSAGE(), ON_REGISTERED_MESSAGE(), ON_THREAD_MESSAGE() and
ON_REGISTERED_THREAD_MESSAGE().
To get a compile-time error when using these macros, you can re-define the
macros after the "#include <afxwin.h>" line in your Stdafx.h file. The code
below uses the static_cast<> operator to aid the compiler and developer by
doing strict type conversion on the function pointer:
#undef ON_MESSAGE
#define ON_MESSAGE(message, memberFxn) \
{ message, 0, 0, 0, AfxSig_lwl, \
(AFX_PMSG) (AFX_PMSGW) (static_cast< LRESULT (AFX_MSG_CALL
CWnd::*)(WPARAM, LPARAM) > (&memberFxn)) },
#undef ON_REGISTERED_MESSAGE
#define ON_REGISTERED_MESSAGE(nMessageVariable, memberFxn) \
{ 0xC000, 0, 0, 0, (UINT)(UINT*)(&nMessageVariable), \
(AFX_PMSG)(AFX_PMSGW)(static_cast<LRESULT (AFX_MSG_CALL
CWnd::*)(WPARAM, LPARAM)>(&memberFxn)) },
#undef ON_THREAD_MESSAGE
#define ON_THREAD_MESSAGE(message, memberFxn) \
{ message, 0, 0, 0, AfxSig_vwl, \
(AFX_PMSG)(AFX_PMSGT)(static_cast<void (AFX_MSG_CALL
CWinThread::*)(WPARAM, LPARAM)>(&memberFxn)) },
#undef ON_REGISTERED_THREAD_MESSAGE
#define ON_REGISTERED_THREAD_MESSAGE(nMessageVariable, memberFxn) \
{ 0xC000, 0, 0, 0, (UINT)(UINT*)(&nMessageVariable), \
(AFX_PMSG)(AFX_PMSGT)(static_cast<void (AFX_MSG_CALL
WinThread::*)(WPARAM, LPARAM)>(&memberFxn)) },
The ON_MESSAGE(), ON_REGISTERED_MESSAGE(), ON_THREAD_MESSAGE() and
ON_REGISTERED_THREAD_MESSAGE() macros are defined in
\mfc\include\afxmsg_.h.