网球浪子 发表于 2008-5-21 18:24

求助!!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);
        }
}

[color=LightBlue]错误说明: “static_cast”: 无法从“UINT (__thiscall CCoolDialogBar::* )(CPoint)”转换为“LRESULT (__thiscall CWnd::* )(CPoint)”[/color]

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);
}

[[it] 本帖最后由 网球浪子 于 2008-5-21 21:07 编辑 [/it]]

网球浪子 发表于 2008-5-21 18:25

在线等达人解答

网球浪子 发表于 2008-5-21 19:04

第三个问题已经解决,但是前面两个没有解决,急切需要高手

pigppy 发表于 2008-6-24 13:32

这种问题我也有遇到啊,不知道改怎么解决呢,希望高手指点一下啦。

zz_tot 发表于 2008-8-2 12:20

你的 声明 和  实现
把 void 改成 LRESULT 就过去了
2005 是需要返回值的

页: [1]

编程论坛