error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
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)改成LRESULT CTransparentWnd::OnLiben(WPARAM wParam,LPARAM lParam),声明处也要改,如afx_msg LRESULT OnLiben(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相关推荐
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to ...
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESU ...
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRE
转自 http://blog.sina.com.cn/s/blog_6f2d29af01011n77.html error C2440: "static_cast": 无法从&qu ...
- error C2440: ’static_cast’ : cannot convert from ‘UINT (__thiscall CStaticLink::* )(CPoint)’ to ‘LRE
转自VC错误:http://www.vcerror.com/?p=1539 问题描述: 在把VC6.0 工程转到VS2008工程中遇到下面的问题: error C2440: 'static_cast' ...
- c++ mfc无法转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)错误处理
在MFC映射消息函数时出现类型无法转换void到LRESULT 先修改映射函数声明的返回类型为LRESUTL 接着修改函数实现的返回类型为LRESULT 最后给映射函数增加返回值 重新生成,问题解决
- error LNK2019: 无法解析的外部符号 public: virtual void * __thiscall
vs2010,qt5.7 error LNK2001: 无法解析的外部符号 "public: virtual void * __thiscall MyThread::qt_metacast( ...
- error C2440 无法转换到 AFX_PMSG mfc自定义信号及实现 PostMessage FindWindow
这两天在用自定义信号,期间除了一些问题,看似简单,实际上花了我好长时间.也是因为本身没怎么用过mfc,纯粹是被赶鸭子上架,赶上来的. 奔着分享和记录的目的,希望碰到同样问题的猿们快速解决问题. 首先说 ...
- 关于错误error C4430 error C2365 error C2078 error C2440 error C2143的处理。
关于错误error C4430 error C2365 error C2078 error C2440 error C2143的处理. 楼主在公司接手了一段代码.编译的时候发现一个很奇怪的问题,就是获 ...
- string转Char*( error C2440: '=' : cannot convert from 'const char *' to 'char *')
今天遇到一个问题string转char*总是失败提示错误为 error C2440: '=' : cannot convert from 'const char *' to 'char *' 源代码为 ...
- cv_bridge与python版本问题导致编译错误error: return-statement with no value, in function returning ‘void*’ [-fpe
1.先说一下报错的过程(着急看解决过程的直接看第二点): 首先,在使用OpenCV时候,报错如下: [ERROR] [1663728000.010723, 6019.022000]: bad call ...
最新文章
- php 的 危 险 参 数
- 基于Nginx实现10万+并发,你应该做的Linux内核优化
- python【蓝桥杯vip练习题库】BASIC-28Huffuman树(贪心 Huffuman)
- KMeans++算法理论和实现
- 浅析TCP之SACK(选择性确认)
- SAP HANA中创建与时间相关的数据及Time Attribute View(Gregorian)
- Snap svg:路径变换和相交计算
- Vue.use自定义自己的全局组件
- 监控linux终端键盘输入,Linux内核实时监控键盘输入
- walle 2.0 上线部署
- php怎样空格分开输入三个数,php函数在每一空行拆分一个数组?
- 一文学会用 Tensorflow 搭建神经网络
- 完成个人中心—导航标签2
- 超级计算机的生产流程,PCB生产工艺流程,你知道吗?
- 开源一个win10二十四节气壁纸自动更换的程序
- html收藏夹导入mac,Mac浏览器导入其他浏览器收藏-功能说明
- vue页面返回消息头获取_vue在响应头response中获取自定义headers操作
- BPF高阶 - 使用BPF过滤固定特征报文
- HM-16.0编码过程:将YUV文件编码成HEVC格式的码流
- OpenPose ImportError: No module named '_pafprocess'【swig】编译步骤
热门文章
- java获取mysql执行计划_好程序员Java学习路线之MySQL的执行计划
- 最短公共子序列_最短公共超序列
- uva 10602——Editor Nottoobad
- django models模型 内部类 class Meta 简介
- 设计模式----2(简单工厂模式的概念,简单工厂模式的实现,简单工厂模式的优缺点)
- The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
- 几种并发服务器模型的实现:多线程,多进程,select,poll,epoll
- 设计模式(2):工厂方法模式(Factory Method Pattern)
- MMKV集成与原理,薪资翻倍
- 通过Ajax方式上传文件(input file),使用FormData进行Ajax请求