error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
来源:互联网 发布:西安儿童编程培训机构 编辑:程序博客网 时间:2024/05/20 05:09
一定要注意,函数一定要带参数。error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
1> 从基类型到派生类型的强制转换需要 dynamic_cast 或 static_cast
搜索发现为开发平台迁移问题。
由vc6.0升级至vs2005以上平台均会遇到这情况,原因为
VS2005 、VS 2010对消息的检查更为严格,以前在VC6下完全正常运行的消息映射在VS2005下编译不通过
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg voidOnRecvData(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CChatDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_EN_CHANGE(IDC_EDIT_RECV, &CChatDlg::OnEnChangeEditRecv)
ON_BN_CLICKED(IDC_BTN_SEND, &CChatDlg::OnBnClickedBtnSend)
ON_MESSAGE(WM_RECVDATA, &CChatDlg::OnRecvData)
END_MESSAGE_MAP()
编译错误提示:
error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
1> 从基类型到派生类型的强制转换需要 dynamic_cast 或 static_cast
更改定义:
afx_msg void OnRecvData(WPARAM wParam, LPARAM lParam);
为
afx_msg LRESULT OnRecvData(WPARAM wParam, LPARAM lParam);
编译通过
LRESULT是一个数据类型,
MSDN: 32-bit value returned from a window procedure or callback function
指的是从窗口程序或者回调函数返回的32位值。
转载地址:
http://blog.163.com/bbluesnow@126/blog/static/277845452011441511611/
0 0
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- error C2440: “static_cast”: 无法从“void (__thiscall CPppView::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thisca
- 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”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRE
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRE
- error C2440: “static_cast”: 无法从“void (__thiscall CTransparentWnd::* )(WPARAM,LPARAM)”转换为“LRESULT (__
- 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)”
- vs2008 error C2440: “static_cast”: 无法从“void (__thiscall CMainFrame::* )(void)”转换为“LRESULT (__thiscal
- “static_cast”: 无法从“void (__thiscall CMyNetChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)
- : error C2440: “static_cast”: 无法从“void (__thiscall CBCGPInformationBar::* )(WPARAM,LPARAM)”转换为“LRESU
- 2440: “static_cast”: 无法从“void (__thiscall CMainDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd:
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- 独白
- Leetcode_combination-sum
- MPICH2
- 初学extjs
- java多态示例:
- error C2440: “static_cast”: 无法从“void (__thiscall CChatDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscal
- 2014年CSDN编程挑战赛 - 检查交替字符串
- 自定义控件的 TypedArray和obtainStyledAttributes使用
- [hdu 2014] 青年歌手大奖赛_评委会打分
- Qt学习笔记02_Frame类族
- POJ 1753:Flip Game:棋盘枚举1
- socket 可读 可写 条件
- 为什么选择一个好的域名,能够帮助网站更加的容易被人记住
- has been modified since the precompiled header was built IOS开发