RT

解决方案 »

  1.   

    CMyView *pView = (CMyView *)((CMainFrame *)AfxGetMainWnd())->GetActiveView();
      

  2.   

    pView->GetDocument() ;
    不要忘记了包含相关文件
    技术上可行
    符合你的要求吗?
    如果不明白
    请给我发短消息
    请附: 帖子的地址
      

  3.   

    把pDocTemplate变为app的成员变量。POSITION p = pDocTemplate->GetFirstDocPosition();
    if(p!=NULL)
    {
    CDocument* pDoc = pDocTemplate->GetNextDoc(p);
    //p = pDoc->GetFirstViewPosition();
    //CView* pView = pDoc->GetNextView(p);
    }
      

  4.   

    ((CFrameWnd *)AfxGetMainWnd())->GetActiveDocument()
      

  5.   

    //Assume only Doc associated with each DocTemplate
    POSITION psTemplate = this->GetFirstDocTemplatePosition();
    CDocTemplate *pDocTemplate = NULL;
    CDocument *pDoc = NULL;
    while(psTemplate)
    {
      pDocTemplate = this->GetNextDocTemplate(psTemplate);
      if(NULL != pDocTemplate)
      {
         CString strDoc;
         pDocTemplate->GetDocString(strDoc,CDocTemplate::filterExt);
        if(!strcmp(".YourDocType",strDoc))
        {
    // ok Find the Doc. Get the Doc Pointer;
     POSITION ps = pDocTemplate->GetFirstDocPosition();
    pDoc = pDocTemplate->GetNextDoc(ps);
    break;
        }  }
    }
      

  6.   

    include "XXView.h"
    CXXView *pView = (CXXView *)((CMainFrame *)AfxGetMainWnd())->GetActiveView();
    pView->GetDocument() ;