我在菜单中使用如下程序调用一个FormView:if(m_Hoist!=NULL)
{
m_Hoist->MDIActivate();
return;
} m_Hoist=new CChildFrame();
CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS(CHoistOperation);
if(!m_Hoist->LoadFrame(IDR_MAINFRAME,WS_MAXIMIZE|WS_OVERLAPPEDWINDOW,this,&context))
return;
m_Hoist->ShowWindow(SW_SHOWMAXIMIZED);
m_Hoist->InitialUpdateFrame(NULL,true);在我的FormView的OnInitialUpdate中有如下程序:
CFormView::OnInitialUpdate();

ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCrane_CMSDoc)));(执行这条语句时报错)
CCrane_CMSDoc *pDoc = (CCrane_CMSDoc*)m_pDocument;

//CFormView * aa=pDoc->GetNextView ;
pDoc->SetTitle("Form1");
在程序编译时,没有任何错误和警告.谢谢大家帮忙看看!

解决方案 »

  1.   

    你看看CCreateContext 有几个成员?
      

  2.   

    context有如下五个成员,
             context.m_pCurrentDoc
             context.m_pCurrentFrame
    context.m_pLastView
    context.m_pNewDocTemplate
    context.m_pNewViewClass
      

  3.   

    ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCrane_CMSDoc)));(执行这条语句时报错)
    m_pDocument不是一上CCrane_CMSDoc的实例的指针?
    如果是,那么m_pDocument应该已经被破坏了
      

  4.   

    把文档的指针赋给context.m_pCurrentDoc
      

  5.   

    不太明白???????????????其实我的功能很简单,只是在FormView启动时,能够更改CDocument 对象的标题名称
      

  6.   

    你使用了错误的CCreateContext来创建框架
    参考
    http://topic.csdn.net/t/20041105/20/3526364.html