error C2440: 'static_cast' : cannot conver

2019-05-30 17:31发布

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条回答
疯言疯语
2楼-- · 2019-05-30 18:12

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

查看更多
登录 后发表回答