各位提提意见阿。
看看也行啊 

解决方案 »

  1.   

    Unhandled expression .....在调用RecalcLayout时   ( diandian 回复于:2001-11-16 16:00:00)   First-chance exception in CoinDs.exe (MFC42D.DLL): 0xC0000005: Access Violation.我想问问Context和RecalcLayout的关系LRESULT CWnd::Default()
    {
        // call DefWindowProc with the last message
        _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
        return DefWindowProc(pThreadState->m_lastSentMsg.message,
    ******        pThreadState->m_lastSentMsg.wParam, pThreadState->m_lastSentMsg.lParam);*****为出错后停的位置
     
     
     我在OnCreateClient外自己写个函数   ( diandian 回复于:2001-11-16 16:05:00)   void CChildFrame::ResetView()
    {.........
        CCreateContext Context;
        CCreateContext *pContext;
        CPortView * pActiveView=(CPortView*)m_wndSplitter->GetPane( curRow, curCol);
        CCDDoc * pDoc=(CCDDoc *)pActiveView->GetDocument();
        if (pActiveView == NULL)
           AfxMessageBox("noview");
        Context.m_pNewViewClass= GetRuntimeClass();
        Context.m_pCurrentDoc=pDoc;//pActiveView->GetDocument();
        Context.m_pNewDocTemplate=NULL;//pDoc->GetDocTemplate();
        Context.m_pLastView=NULL;
        Context.m_pCurrentFrame=GetParentFrame();
        if (m_wndSplitter->m_hWnd)
           m_wndSplitter->DestroyWindow();
        else
        {
          for(int i=0; i<4; i++)for(int j=0; j<4; j++)
         {
           CPortView* pV = (CPortView *)m_wndSplitter->GetPane(i,j);
                pV->DestroyWindow();
         }
        }    pDoc->m_bAutoDelete=TRUE;
           delete m_wndSplitter;
           m_wndSplitter = new CMySplitterWnd;    
      
        if(!(m_wndSplitter->CreateStatic( this, 2, 2)))    
            return ;//2*2
        //init formview
        for(int i=0; i<2; i++)
          for(int j=0; j<2; j++)
          {
           m_wndSplitter->CreateView( i, j,
            RUNTIME_CLASS(CPortView),
            CSize( 145, 122)        ,//pane 的大小
            &Context    
                    );}
        for( i=0; i<2; i++)for(int j=0; j<2; j++)
        {
            CPortView* pV = (CPortView *)m_wndSplitter->GetPane(i,j);
            pV->OnInitialUpdate();
        }
        for( i=0; i<2; i++)
        {
            m_wndSplitter->SetColumnInfo( i, 150, 145);
            m_wndSplitter->SetRowInfo(    i, 125, 110);
        }
        m_wndSplitter->RecalcLayout();
    解释在后面(续) 
     
     解释如下   ( diandian 回复于:2001-11-16 16:10:00)   CPortView从CView继承,作为OnCreateClient的RUNTIME_CLASS(CPortView)
    工程名为CoinDS  CCDoc CCDView 
    程序在m_wndSplitter->RecalcLayout();停止,并出现Unhandled expression .....
    进入LRESULT CWnd::Default()
    {
        // call DefWindowProc with the last message
        _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
        return DefWindowProc(pThreadState->m_lastSentMsg.message,
    ******        pThreadState->m_lastSentMsg.wParam, pThreadState->m_lastSentMsg.lParam);*****为出错后停的位置