error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
来源:互联网 发布:特朗普 金正恩 知乎 编辑:程序博客网 时间:2024/05/20 05:26
error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
1>
搜索发现为开发平台迁移问题。
由vc6.0升级至vs2010以上平台均会遇到这情况,原因是
VS2010对消息的检查更为严格,以前在VC6下完全正常运行的消息映射在VS2010下编译不通过
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnRecvData(WPARAM wParam, LPARAM lParam); //添加的消息映射函数
DECLARE_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CChatDlg, CDialog)
ON_MESSAGE(WM_RECVDATA, &CChatDlg::OnRecvData) //绑定消息与函数
END_MESSAGE_MAP()
编译错误提示:
error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
1>
解决方案:
afx_msgvoidOnRecvData(WPARAM wParam, LPARAM lParam);
为
afx_msg LRESULTOnRecvData(WPARAM wParam, LPARAM lParam);
然后给函数一个返回值。
编译通过
LRESULT是一个数据类型,
MSDN: 32-bit value returned from a window procedure or callback function
指的是从窗口程序或者回调函数返回的32位值。
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CTCP服务器程序Dlg::* )(WPARAM,LPARAM)'
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall MenuToolBar::* )(LPARAM,LRESULT *)' to 'void (__thiscall CCmd
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall MenuToolBar::* )(LPARAM,LRESULT *)' to 'void (__thiscall CCmd
- error C2440 static_cast:cannot convert from void (_thiscall X::*)(WPARAM,LPARAM)to LRESULT(_thiscall
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRE
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thisca
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRE
- error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CchatDlg::* )(CPoint)' to 'UI
- error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CchatDlg::* )(CPoint)' to 'UI
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CTrunkPage::* )(void)' to 'void (__thiscall CCmdTarget::* )(N
- VS2010 error C2440: 'static_cast' : cannot convert from 'void (__thiscall CKeyexeDlg::* )(WPARAM,LP
- Android中asset文件夹与raw文件夹的区别深入解析
- 算法之动态规划(LCS最长公共子序列, edit distance,交叉子串)
- VC++深入详解(孙鑫)在VS2010学习中碰到的几个调试问题
- 解决办法:Access restriction: The type JPEGImageEncoder is not accessible due to restriction
- java中枚举举例说明
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- Copy List with Random Pointer
- 将prezi试用期无限延长的办法
- lldb stack base pointer
- Asteroids
- C# Winform App.config加密 aspnet_regiis
- Intent.ACTION_VIEW
- gcc命令objdump用法
- GDB TO LLDB COMMAND MAP