我在程序中注册了一个模板pDocTemplate1,现在我要打开显示这个模板;
方法:(((CMulitApp*)AfxGetApp())->pDocTemplate1)->OpenDocumentFile(NULL);出现问题:
    我在编译时没有问题,但是在执行时出错(什么内存不能"read"),是为什么?

解决方案 »

  1.   

    应该是你的模板pDocTemplate1->的错。
      

  2.   

    pDocTemplate1有没有为NULL?
      

  3.   

    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(
    IDR_MULITTYPE,
    RUNTIME_CLASS(CMulitDoc),
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CMulitView));
    AddDocTemplate(pDocTemplate);

    CMultiDocTemplate* pDocTemplate1;
    pDocTemplate1 = new CMultiDocTemplate(
    IDR_MULITTYPE1,
    RUNTIME_CLASS(CMulitDoc),
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CMulitView));
    AddDocTemplate(pDocTemplate1);
    // create main MDI Frame window
    CMainFrame* pMainFrame = new CMainFrame;
    if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
    return FALSE;
    m_pMainWnd = pMainFrame;然后在STRING中加上
    IDR_MULITTYPE1
    \nMulit\nMytext\n\n\nMulit1.Document\nMulit Document应该就可以了嘛,有什么不对