error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CImportProjectDlg::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)'

走远了吗. 提交于 2019-12-07 21:49:01

问题


I am converting a VC++6.0 project to Visual Studio 2008 (enroute to 2014). I am encountering the above error.

Here is my code snippet:

BEGIN_MESSAGE_MAP(CImportProjectDlg, CDialog)
//{{AFX_MSG_MAP(CImportProjectDlg)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
ON_WM_SIZING()
ON_WM_PAINT()
ON_WM_NCHITTEST()
ON_BN_CLICKED(IDC_MERGE_IN, OnAdd)
ON_BN_CLICKED(IDC_MERGE_OUT, OnRemove)
ON_BN_CLICKED(IDC_IMPORTPROJECT_CLEARALL, OnClearAll)
ON_BN_CLICKED(IDC_IMPORTPROJECT_APPLY, OnApply)
ON_BN_CLICKED(IDCANCEL,OnCancel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

And the error is indicated on the ON_WM_NCHITTEST() line.

Very puzzling.


回答1:


The correct signature for OnNcHitTest handler is afx_msg LRESULT OnNcHitTest(CPoint);. You have it return UINT instead of LRESULT.



来源:https://stackoverflow.com/questions/42442457/error-c2440-static-cast-cannot-convert-from-uint-thiscall-cimportprojec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!