(using Visual Studio 2012, same behaviour with VS2015)
I wanted to do a simple 64 bit MFC dialog application with a simple WM_MESSAGE handler.
This is what I did.
1. Open VS2012
2. Create new MFC dialog based application. (default is 32bit)
3. Add my message handler code (WM_MESSAGE and handler code)
4. Compile: All OK.
5. Add new x64 configuration (from base win32)
6. Compile: Compilation error on WM_MESSAGE
1>------ Build started: Project: MFCApplication1, Configuration: Release x64 ------
1> MFCApplication1Dlg.cpp
1>MFCApplication1Dlg.cpp(66): error C2440: 'static_cast' : cannot convert from 'HRESULT (__cdecl CMFCApplication1Dlg::* )(WPARAM,LPARAM)' to 'LRESULT (__cdecl CWnd::* )(WPARAM,LPARAM)'
1> None of the functions with this name in scope match the target type
The related code:
BEGIN_MESSAGE_MAP(CMFCApplication1Dlg, CDialogEx)
...
ON_MESSAGE(WM_MY_MESSAGE, MyMessageHandle )
END_MESSAGE_MAP()
class CMFCApplication1Dlg : public CDialogEx
{
HRESULT MyMessageHandle(WPARAM wParam, LPARAM lParam );
};
HRESULT CMFCApplication1Dlg::MyMessageHandle(WPARAM wParam, LPARAM lParam )
{
return 0;
}
Handler signature seems to be OK. (
HRESULT f(WPARAM, LPARAM)
), Message Map looks ok.
There are tons of messages like that on the internets, but they all related to having a bad handler prototype (usually from porting from an older Visual Studio).
Any idea that I might have overlooked ?
I'm kind of stumped.
Thanks.
Max.