错误C2440:'static_cast':无法从'BOOL(__thiscall CExListCtrl :: *)(WPARAM,LPARAM,LRESULT *)'转换为'void(__thiscall CCmdTarget :: *)(NMHDR *,LRESULT *)' [英] error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CExListCtrl::* )(WPARAM,LPARAM,LRESULT *)' to 'void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT *)'

查看:391
本文介绍了错误C2440:'static_cast':无法从'BOOL(__thiscall CExListCtrl :: *)(WPARAM,LPARAM,LRESULT *)'转换为'void(__thiscall CCmdTarget :: *)(NMHDR *,LRESULT *)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的兄弟,

我正在将vc6项目转换为Visual Studio 2005的vc8,我收到了这个错误。请建议一个摆脱这个的解决方案。



有一个功能如下

Dear bros,
I am converting a vc6 project to vc8 that is visual studio 2005 and I am getting this error. Please suggest a solution to get rid of this.

There is a funtion as following

BOOL CExListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
        HD_NOTIFY   *pHDN = (HD_NOTIFY*)lParam;

        if((pHDN->hdr.code == HDN_BEGINTRACKW || pHDN->hdr.code == HDN_BEGINTRACKA || pHDN->hdr.code == HDN_DIVIDERDBLCLICKA || pHDN->hdr.code == HDN_DIVIDERDBLCLICKW )
                && pHDN->iItem == 5)            // Prevent only first (col# 0) from resizing
        {
                *pResult = TRUE;                // disable tracking
                return TRUE;                    // Processed message
        }
 		 
        return CListCtrl::OnNotify(wParam, lParam, pResult);
}





这是由编译器在通过时捕获的



this is caught by compiler when is passed through

ON_NOTIFY_REFLECT(WM_NOTIFY, OnNotify )macro funtion. 



所以请建议我如何完成它。



感谢你

saffiuddin


So please suggest me how to get it done.

Thanking You
saffiuddin

推荐答案

看起来VC6中的宏 ON_NOTIFY_REFLECT 与VC2005中的不同。这可能是一个环境使用ATL版本,另一个环境使用MFC版本的结果。

在两个环境中使用按钮F12(文本光标在单词 ON_NOTIFY_REFLECT 中闪烁),它将带您进入宏定义。



希望这会有所帮助,

Pablo。
It looks like the macro ON_NOTIFY_REFLECT in VC6 is different from the one in VC2005. This may be the result of one environment using the ATL version, and the other the MFC version.
Use the button F12 (with the text cursor blinking in the word ON_NOTIFY_REFLECT) on both environments, it will bring you to the macro definition.

Hope this helps,
Pablo.


确保'OnNotify'的返回类型始终是LRESULT整个解决方案。
Make sure that return type for 'OnNotify'is always LRESULT entire your solution.


这篇关于错误C2440:'static_cast':无法从'BOOL(__thiscall CExListCtrl :: *)(WPARAM,LPARAM,LRESULT *)'转换为'void(__thiscall CCmdTarget :: *)(NMHDR *,LRESULT *)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆