Problem with User Message Maps converting from VC6 to .net 2003
-
Hi All, I am converting a project from VC6 to .net2003 and am running into a compiler error with my (user) message maps. I can't see what is wrong - worked fine in VC6... Here is the compiler error: SimParamsDialog.cpp(80) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSimParamsDialog::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' None of the functions with this name in scope match the target type Here are the message maps: - these defines are actually in a .h file #define WM_LOADSENSORSTOGRID WM_USER + 1 #define WM_LOADCALDATATOGRID WM_LOADSENSORSTOGRID + 1 BEGIN_MESSAGE_MAP(CSimParamsDialog, CFormView) //{{AFX_MSG_MAP(CSimParamsDialog) ON_BN_CLICKED(IDC_BUTTON_SENDALARM, OnButtonSendAlarm) ON_WM_TIMER() ON_MESSAGE(WM_LOADSENSORSTOGRID, OnLoadSensorsToGrid) ON_MESSAGE(WM_LOADCALDATATOGRID, OnLoadCalDataToGrid) //}}AFX_MSG_MAP END_MESSAGE_MAP() and the function(s): void CSimParamsDialog::OnLoadSensorsToGrid(WPARAM wParam, LPARAM lParam) { etc } void CSimParamsDialog::OnLoadCalDataToGrid(WPARAM wParam, LPARAM lParam) { etc } Any ideas? Again this works in VC6... Thanks John
-
Hi All, I am converting a project from VC6 to .net2003 and am running into a compiler error with my (user) message maps. I can't see what is wrong - worked fine in VC6... Here is the compiler error: SimParamsDialog.cpp(80) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSimParamsDialog::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' None of the functions with this name in scope match the target type Here are the message maps: - these defines are actually in a .h file #define WM_LOADSENSORSTOGRID WM_USER + 1 #define WM_LOADCALDATATOGRID WM_LOADSENSORSTOGRID + 1 BEGIN_MESSAGE_MAP(CSimParamsDialog, CFormView) //{{AFX_MSG_MAP(CSimParamsDialog) ON_BN_CLICKED(IDC_BUTTON_SENDALARM, OnButtonSendAlarm) ON_WM_TIMER() ON_MESSAGE(WM_LOADSENSORSTOGRID, OnLoadSensorsToGrid) ON_MESSAGE(WM_LOADCALDATATOGRID, OnLoadCalDataToGrid) //}}AFX_MSG_MAP END_MESSAGE_MAP() and the function(s): void CSimParamsDialog::OnLoadSensorsToGrid(WPARAM wParam, LPARAM lParam) { etc } void CSimParamsDialog::OnLoadCalDataToGrid(WPARAM wParam, LPARAM lParam) { etc } Any ideas? Again this works in VC6... Thanks John
AFAIK your functions have to return an LRESULT, not a void.
LRESULT CSimParamsDialog::onloadSensorsToGrid(WPARAM wParam, LPARAM lParam)
{
...
return 0;
}LRESULT CSimParamsDialog::onloadCalDataToGrid(WPARAM wParam, LPARAM lParam)
{
...
return 0;
}
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
-
AFAIK your functions have to return an LRESULT, not a void.
LRESULT CSimParamsDialog::onloadSensorsToGrid(WPARAM wParam, LPARAM lParam)
{
...
return 0;
}LRESULT CSimParamsDialog::onloadCalDataToGrid(WPARAM wParam, LPARAM lParam)
{
...
return 0;
}
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
Thanks - that did it! Worked fine in VC6...odd that it didn't catch that. John