| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦   
共有 1309 人关注过本帖
标题:求助!!vc++2005程序编译出错,vc6没问题
收藏  订阅  推荐  打印
网球浪子
Rank: 1
等级:新手上路
帖子:8
积分:182
注册:2008-5-21
求助!!vc++2005程序编译出错,vc6没问题

共有三个编译错误,但是在vc6却没有问题,2005无法通过,求达人帮助
错误说明: “static_cast”: 无法从“void (__thiscall COutputView::* )(const CString *)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”

    afx_msg void OnAddString(const CString* str); //头文件声明
    ON_MESSAGE(UMSG_ADDSTRING,OnAddString)

void COutputView::OnAddString(const CString* str) //源函数定义
{
    m_strList.AddTail(*str);

    CSize size = GetTotalSize();
    int height = m_strList.GetCount()*m_FontHeight;
    if(height > size.cy){
        SetScrollSizes(MM_TEXT,CSize(500,height));
        POINT pt;
        pt.x = 0;
        pt.y = height;
        ScrollToPosition(pt);
    }

    Invalidate(FALSE);

    MSG msg;
    if(::PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
        ::SendMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
    }
}

错误说明:“static_cast”: 无法从“void (__thiscall COutputView::* )(void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”    
    afx_msg    void OnRemoveAllString(); //头文件声明
    ON_MESSAGE(UMSG_REMOVEALLSTRING,OnRemoveAllString)

void COutputView::OnRemoveAllString() //源函数定义
{
    m_strList.RemoveAll();
    SetScrollSizes(MM_TEXT,CSize(500,200));
    Invalidate(FALSE);

    MSG msg;
    if(::PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
        ::SendMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
    }
}

错误说明: “static_cast”: 无法从“UINT (__thiscall CCoolDialogBar::* )(CPoint)”转换为“LRESULT (__thiscall CWnd::* )(CPoint)”

afx_msg UINT OnNcHitTest(CPoint point); //头文件声明

UINT CCoolDialogBar::OnNcHitTest(CPoint point)  //源函数定义
{
    if (IsFloating())
        return CControlBar::OnNcHitTest(point);

    CRect rc;
    GetWindowRect(rc);
    point.Offset(-rc.left, -rc.top);
    if(m_rectClose.PtInRect(point))
        return HTSYSMENU;
    else if (m_rectUndock.PtInRect(point))
        return HTMINBUTTON;
    else if (m_rectGripper.PtInRect(point))
        return HTCAPTION;
    else if (m_rectBorder.PtInRect(point))
        return HTSIZE;
    else
        return CControlBar::OnNcHitTest(point);
}

[ 本帖最后由 网球浪子 于 2008-5-21 21:07 编辑 ]
2008-5-21 18:24
网球浪子
Rank: 1
等级:新手上路
帖子:8
积分:182
注册:2008-5-21

在线等达人解答
2008-5-21 18:25
网球浪子
Rank: 1
等级:新手上路
帖子:8
积分:182
注册:2008-5-21

第三个问题已经解决,但是前面两个没有解决,急切需要高手
2008-5-21 19:04
pigppy
Rank: 1
等级:新手上路
帖子:4
积分:142
注册:2008-6-21

这种问题我也有遇到啊,不知道改怎么解决呢,希望高手指点一下啦。
2008-6-24 13:32
zz_tot
Rank: 1
等级:新手上路
帖子:23
积分:352
注册:2007-7-4

你的 声明 和  实现
把 void 改成 LRESULT 就过去了
2005 是需要返回值的
2008-8-2 12:20
共有 1308 人关注过本帖
发新话题
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.050254 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved