出现这个错误的原因可是“人力不可抗拒”之原因造成的,因为旧版本的
ON_WM_NCHITTEST 宏使用了
UINT (__thiscall CWzButton::*
)(CPoint);
类型的类成员函数指针,其定义如下:
#define
ON_WM_NCHITTEST() \
{ WM_NCHITTEST, 0, 0, 0, AfxSig_wp, \
(AFX_PMSG)(AFX_PMSGW)(UINT (AFX_MSG_CALL CWnd::*)(CPoint))&OnNcHitTest
},
但是新版本变成了:
#define ON_WM_NCHITTEST() \
{ WM_NCHITTEST,
0, 0, 0, AfxSig_l_p, \
(AFX_PMSG)(AFX_PMSGW) \
(static_cast< LRESULT
(AFX_MSG_CALL CWnd::*)(CPoint) > (&ThisClass :: OnNcHitTest))
},
注意返回值类型由UINT改成了LRESULT,再加上static_cast的严格检查,所以就出错了。修改的方法就是将你的OnNcHitTest函数由:
afx_msg UINT OnNcHitTest(CPoint
point);
改成:
afx_msg LRESULT
OnNcHitTest(CPoint point);
UINT CHyperLink::OnNcHitTest(CPoint /*point*/)
改成:
LRESULT CHyperLink::OnNcHitTest(CPoint /*point*/)
将UINT改成LRESULT
http://msdn.microsoft.com/zh-cn/library/sy5tsf8z.aspx