解决C++ 无法从void 转换为LRESULT的方法详解
来源:互联网 发布:吉诺比利巅峰数据 编辑:程序博客网 时间:2024/06/06 02:04
这个应该是一个MFC程序,ON_MESSAGE是添加消息响应函数,这句话就是添加热键WM_HOTKEY的响应函数。当你注册了热键之后,当用户按下热键,会执行OnHotKey函数来处理这个消息。错误就应该是OnHotKey这个函数的声明错误了,返回值应该是LRESULT. VS2008对消息的检查更为严格,以前在VC6下完全正常运行的消息映射在VS2008下编译不通过
ON_MESSAGE(WM_message,OnMyMessage);
OnMessage返回值必须为LRESULT,其形式为:afx_msg LRESULT OnMessage(WPARAM, LPARAM);
如果不符合,则有错误提示:error C2440: “static_cast”:无法从“void (__thiscall CMainFrame::* )(void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
解决方法如下:首先,把原来的消息函数返回值类型改为LRESULT,函数内可以随便写个return 0;然后消息函数的参数必须改写成(WPARAM wParam,LPARAM lParam)。
0 0
- 解决C++ 无法从void 转换为LRESULT的方法详解
- 解决C++ 无法从void 转换为LRESULT的方法详解
- 解决C++ 无法从void 转换为LRESULT的方法详解
- C++ 无法从void 转换为 LRESULT
- C++ 无法从void 转换为 LRESULT
- error C2440: “static_cast”: 无法从“void (__thiscall CXXDlg* )(void)”转换为“LRESULT (__thiscall CWnd:的错误
- static_cast” : 无法从“void (__thiscall CMainFrame::* )(NMTOOLBARA *,LRESULT *)”转换为“void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT
- static_cast” : 无法从“void (__thiscall CMainFrame::* )(NMTOOLBARA *,LRESULT *)”转换为“void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT
- MFC无法void转换为LRESULT
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__t
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARA
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thisca
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thisca
- Hibernate 查询数据
- Android 测试环境搭建(Win7)
- scala(一)/Haskel(一)
- 整理一下算法和数据结构
- 《ACM程序设计》书中题目 N
- 解决C++ 无法从void 转换为LRESULT的方法详解
- Hibernate 修改数据
- 《打造高绩效团队》读书笔记
- google API Design Guide
- Feign报错:Attribute 'value' in annotation,must be declared as an @AliasFor [serviceId], not [name]
- 队列的分类与应用场景
- JavaWeb——servlet介绍
- HTML5、CSS3新标签、属性概况
- LeetCode 208. Implement Trie (Prefix Tree)