error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ...................
-
Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file
// Generated message map functions //{{AFX\_MSG(CCancelUIThread) afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam); afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); //}}AFX\_MSG
Code in .CPP file
BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
//{{AFX_MSG_MAP(CCancelUIThread)
ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()And the function definations. Please help me out. Thanks In Advance
-
Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file
// Generated message map functions //{{AFX\_MSG(CCancelUIThread) afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam); afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); //}}AFX\_MSG
Code in .CPP file
BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
//{{AFX_MSG_MAP(CCancelUIThread)
ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()And the function definations. Please help me out. Thanks In Advance
What is line 138? Have you tried:
ON_MESSAGE(CM_PROGRESS_STEPIT, &CCancelUIThread::OnStepProgress)
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file
// Generated message map functions //{{AFX\_MSG(CCancelUIThread) afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam); afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); //}}AFX\_MSG
Code in .CPP file
BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
//{{AFX_MSG_MAP(CCancelUIThread)
ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()And the function definations. Please help me out. Thanks In Advance
Ummm - a CWinThread is not a CWnd, so it can't have ON_MESSAGE handlers. It *can* have ON_THREAD_MESSAGE handlers, though…so use those instead... The reason VC6 doesn't complain is that its compiler is so lax at checking and enforcing static typing rules. That's a bad thing, m'kay, 'cause it means there can be many latent, potential bugs left in your code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!