无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
来源:互联网 发布:淘宝美工关联 编辑:程序博客网 时间:2024/05/21 21:45
error C2440
“static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
不能转换void (_thiscall CMainFrame::*)(void)to LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)开发平台由VC6.0升级至VS2005,需要将原有的项目迁移。
可能碰到类似错误:
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESULT (__thiscall CWnd::* (WPARAM,LPARAM)'
VS2005对消息的检查更为严格,以前在VC6下完全正常运行的消息映射在VS2005下编译不通过
ON_MESSAGE(WM_message,OnMyMessage);
OnMyMessage返回值必须为LRESULT,其形式为:afx_msg LRESULT OnMyMessage(WPARAM, LPARAM);如果不符合,则有错误提示:
error C2440: “static_cast”: 无法从“void (__thiscall CPppView::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”在匹配目标类型的范围内没有具有该名称的函数
error C2440: “static_cast”: 无法从“void (__thiscall CPppView::* ) (void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”在匹配目标类型的范围内没有具有该名称的函数
解决方法如下:
例如:TransparentWnd.cpp中ON_MESSAGE(WM_LIBEN,OnLiben):
第一:把原来的消息函数返回值类型改为LRESULT(找到OnLiben定义,如Viod CTransparentWnd::OnLiben(WPARAM wParam,LPARAM lParam)改成LRESULTCTransparentWnd::OnLiben(WPARAM wParam,LPARAM lParam),声明处也要改,如afx_msg LRESULTOnLiben(WPARAM wParam,LPARAM lParam););
第二:函数内可以随便写个return TRUE;
第三:然后消息函数的参数必须改写成(WPARAM wParam,LPARAM lParam)而不论这两个参数是否用得到;
第四:消息映射如ON_MESSAGE(WM_MESSAGE, OnMyMessage)
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- 【转】error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- “static_cast”: 无法从“void (__thiscall CMyNetChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
- 无法从“void (__thiscall CtestDlg::* )(void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
- 无法从“void (__thiscall CtestDlg::* )(void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
- 2440: “static_cast”: 无法从“void (__thiscall CMainDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd:
- 无法从“void (__thiscall CCDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )
- error C2440: “static_cast”: 无法从“void (__thiscall CPppView::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARA
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARA
- error C2440: “static_cast”: 无法从“void (__thiscall CMyDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall
- error C2440: “static_cast”: 无法从“void (__thiscall CTransparentWnd::* )(WPARAM,LPARAM)”转换为“LRESULT (__
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT
- 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 CMYQQDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__th
- error C2440: “static_cast”: 无法从“void (__thiscall CXPButton::* )(WPARAM,LPARAM)”转换为“LRESULT (__thisca
- Java的内存
- 为什么匿名内部类和局部内部类只能访问final变量
- mongodb简单介绍以及使用整理2
- ppp是什么,作用是什么
- DBCC大全集之(适用版本MS SQLServer 2008 R2)----DBCC INDEXDEFRAG指定表或视图的索引碎片整理
- 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- Eclipse设置:背景与字体大小和xml文件中字体大小调整
- 获取imageView 的宽高
- SVN上箭头都是什么意思,红色灰色蓝色的
- 手动部署Eclipse内的项目至Tomcat中
- Web测试点-登录,搜索,翻页,输入框
- 学生账号部署XAP程序,在Lumia手机上
- Oracle 11.2.0.1 INS-32025 INS-52001 解决方法
- Java的身份证号码工具类