CWnd是框架类,你把它当成CView类使用了吧

解决方案 »

  1.   

    ? 第349行的注释为
    // panes can be a CWnd, but are usually CViews
    所以这样用是对的吧
    这些程序在一个demo中运正确,
    不过当我加入自己的工程出现这种错误
    我已经对比过源程序,这部分都一行,
    估计是该改的没改??!  
      

  2.   

    sorry,上面错了一个字,应为
    我已经对比过源程序,这部分都一样,
      

  3.   

    demo can download from www.vchelp.net
    file name: rt_demo.zip
      

  4.   

    应该没错。
    试试rebuild all.
    请发一份代码给我。
      

  5.   

    你把CRTForm::GetRealTimeView()中的pWnd->GetPane(0,0)换成pWnd->GetDlgItem(IdFromRowCol(0,0));看看返回什么不就知道了?
      

  6.   

    to a8e
    D:\code\diblook2000.12.26\RTForm.cpp(84) : error C2065: 'IdFromRowCol' : undeclared identifier
    我不太明白你的意思,请讲明白一点。这个程序demo是没错的,我放到自己的程序时出错,
    那个window是这样的,上面是一个CRealTimeView,
    下面是一个RTForm(base class is CFormView)
    中间是个CSplitterWnd分开,
    还有几个控件在下面的form上,
    我不太清楚那个assert错是哪里引起的.
    demo在www.vchelp.net上有
      

  7.   

    demo URL
    http://vchelp.163.net/source/realtime_plot.zip
      

  8.   

    Sorry,IdFromRowCol是CSplitterWnd的成员函数,你可以用AFX_IDW_PANE_FIRST+row*16+col的方法自己得到结果,例如IdFromRowCol(0,0)的结果就是AFX_IDW_PANE_FIRST。
    我的意思是你在自己的函数里按MFC的方法实现的GetPane的功能,看其返回值如何再判断出错原因。
      

  9.   

    你在那里调用GetRealTimeView()?如果在程序启动时如OnCreate()中,此时splitter还没有初始化完成,有可能出现类似错误.
    出错时,查菜单view->Debug Windows->Call Stack看一下函数调用栈,将里面的函数调用关系列出来看看.
      

  10.   

    to softsprite
    KERNEL32! bff76920()
    _CrtDbgReport(int 2, const char * 0x5f4cd8a0 THIS_FILE, int 349, const char * 0x00000000, const char * 0x00000000) line 353
    AfxAssertFailedLine(const char * 0x5f4cd8a0 THIS_FILE, int 349) line 39 + 20 bytes
    CSplitterWnd::IdFromRowCol(int 1, int 0) line 349 + 26 bytes
    CSplitterWnd::GetPane(int 1, int 0) line 363 + 16 bytes
    CRealTimeView::GetRTForm() line 174
    我看不太懂 :(
    我的程序是这样的
    void CRTForm::OnInitialUpdate() 
    {
    CFormView::OnInitialUpdate();

    m_SliderPage.SetType(m_SliderPage.sType::PAGE);
    m_SliderPage.GetClientRect(m_sRect);
    m_SliderPage.SetRange(0, 1, TRUE);
    //m_SliderPage.SetTic(1);
    m_SliderPage.SetPos(1);
    m_SliderPage.SetPageSize(1);
    m_SliderPage.EnableWindow(FALSE);
    MoveWindows();
      那个函数在MoveWindows()中以下是MoveWindows()void CRTForm::MoveWindows()
    {
    CRect rect;
    GetClientRect(rect); CWnd* pView = GetRealTimeView();
    RECT& plotRect = ((CRealTimeView*)pView)->GetGraphRect();
    if (plotRect.right - plotRect.left > 0)
    {
    m_sRect.left = plotRect.left - 10;
    m_sRect.right = plotRect.right + 10;
    m_SliderPage.MoveWindow(m_sRect);
    }
    else
    {
    m_sRect.left = rect.left;
    m_sRect.right = rect.right;
    m_SliderPage.MoveWindow(m_sRect);
    } rect.top = m_sRect.top + m_sRect.Height();
    m_RTGrid.MoveWindow(rect);
    }你可以down一下demo看看,我的与demo没什么区别,
      

  11.   

    把你的OnCreateClient给我看一下!
      

  12.   

    to mousubin
    我没有改写GetClientRect(rect);
    这是mfc的函数
      

  13.   

    MoveWindows()函数不要放在OnInitialUpdate中执行,应放在OnSize中.
      

  14.   


        问题出在pWnd->GetPane(0, 0)上,这时候你的第一个pane(0,0)还没有初始化(即m_hWnd = NULL)。你的OnCreateClient写法估计有问题。另外,好像不需要在OnInitialUpdate里移动窗体吧,在OnSize里处理才是正确的(你是不是vb用多了,什么代码都放到Form_Load里去)。
      

  15.   

    To chuyf: 
        我说的是OnCreateClient重载函数,不是GetClientRect!!!
        十有八九你的重载写的有点问题!
      

  16.   

    请到http://www.etechbase.net/advsearch.php,将你这个问题输入到检索框,然后选择准确匹配查询,应该可以帮助你解决这个问题的。