我在MainFrame里面加了一个消息映射,IDM_FILE_OPEN在MainFrame里面获取到了文件的路径,但是怎样在VIEW类中获取他呢 ???

解决方案 »

  1.   

    我是这样做的,好像不行!
    在MainFrame里面定义了个VIEW类指针
    void CMainFrame::OnFileOpen() 
    {
    // TODO: Add your command handler code here
    CFileDialog filedialog(TRUE);
    CString strpath;
    char pathdir[50];
    memset(pathdir,0,50);
    int pos=-1;
    if(filedialog.DoModal()==IDOK)
    {
    strpath=filedialog.GetPathName();
    //AfxMessageBox(strpath);
    pos=strpath.ReverseFind('\\');
    strpath=strpath.Left(pos+1);//获取文件目录
    strcpy(pathdir,strpath);
    m_pImageView=new CShowImageView;
    m_pImageView->GetPathDir(pathdir);
    }
    }
      

  2.   

    CShowImageView *m_pImageView = (CShowImageView*)this->GetActiveView();