error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)
来源:互联网 发布:网络培训机构北京 编辑:程序博客网 时间:2024/05/25 20:01
当用VS2010打开VC6的程序时会出现以下问题:error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
从基类型到派生类型的强制转换需要 dynamic_cast 或 static_cast
由VC++6.0升级至VS2005以上平台均会遇到这情况,原因为:VS2005及以上版本的VS对消息的检查更为严格,以前在VC6++下完全正常运行的消息映射在VS2005及以上版本的VS下编译不通过。
解决方法:假设自定义消息WM_RECVDATA,该消息发送给CChatDlg,那么需要修改:
1:将afx_msg void OnRecvData(WPARAM wParam,LPARAM lParam) 修改为afx_msg LRUSULT OnRecvData(WPARAM wParam,LPARAM lParam) ;
2:将BEGIN_MESSAGE_MAP和END_MESSAGE_MAP之间的ON_MESSAGE(WM_RECVDATA,OnRecvData)修改为ON_MESSAGE(WM_RECVDATA,&CChatDlg::OnRecvData);
3:将OnRecvData的定义函数void CChatDlg::OnRecvData(WPARAM wParam,LPARAM lParam)修改为
LRESULT CChatDlg::OnRecvData(WPARAM wParam,LPARAM lParam),在具体的实现代码中{}中,返回值:return 0;
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)
- 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)”转换为“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” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- error C2440: “static_cast”: 无法从“void (__thiscall CMyDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall
- 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”: 无法从“void (__thiscall CTransparentWnd::* )(WPARAM,LPARAM)”转换为“LRESULT (__
- : error C2440: “static_cast”: 无法从“void (__thiscall CBCGPInformationBar::* )(WPARAM,LPARAM)”转换为“LRESU
- error C2440: “static_cast”: 无法从“void (__thiscall CPppView::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- error C2440: “static_cast”: 无法从“void (__thiscall CMYQQDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__th
- error C2440: “static_cast”: 无法从“void (__thiscall CXPButton::* )(WPARAM,LPARAM)”转换为“LRESULT (__thisca
- 【转】error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- 用CSS解决textarea warp='hard' !
- ubuntu操作系统学习笔记之管道和重定向
- 黑马程序员_IO流(一)
- skiplist 跳表详解及其编程实现--跳跃链表
- C++的异常处理
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)
- 一个典型的 C++ 程序员成长经历
- 你见过用“5W2H”分析法来做的seo方案吗?
- Go语言中struct的匿名属性特征
- 静态成员变量
- Android之Camera预览
- 浅析JavaScript和PHP中三个等号(===)和两个等号(==)的区别
- spring 初始化对象的过程
- virtual studion中建立项目和方案的流程以及如何关联两个项目