本文介绍了错误 C2440:“static_cast":无法从“UINT (__thiscall CImportProjectDlg::*)(CPoint)"转换为“LRESULT (__thiscall CWnd::*)(CPoint)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 VC++6.0 项目转换为 Visual Studio 2008(到 2014 年).我遇到了上述错误.

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

这是我的代码片段:

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()

错误显示在 ON_WM_NCHITTEST() 行上.

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

非常令人费解.

推荐答案

OnNcHitTest 处理程序的正确签名是 afx_msg LRESULT OnNcHitTest(CPoint);.你让它返回 UINT 而不是 LRESULT.

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

这篇关于错误 C2440:“static_cast":无法从“UINT (__thiscall CImportProjectDlg::*)(CPoint)"转换为“LRESULT (__thiscall CWnd::*)(CPoint)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:58