用的是CEditView...怎样获得当前正在编辑的文件的文件名?如果当前文档还没保存过(硬盘中还不存在这个文件),则弹出保存文档的对话框,之后再获取文件名,执行后序的操作...如果当前文档在硬盘中已经存在,则先保存一下(不出现提示,自动保存),之后再获取文件名,执行后续的操作..这个该怎么写呢?
偶刚学MFC,请高手们,多多指教...

解决方案 »

  1.   

    editview的话,默认的好像就可以满足你的要求吧。要自己做的话,在doc中响应ID_FILE_SAVE命令,使用CFileDialog弹出文件对话框。
    CDocument::GetPathName可取得当前的文件路径,CFileDialog::GetPathName可以取出通过文件对话框选择的文件路径。
      

  2.   

    3Q,Hendy_So(横笛), 不过,在 MyView.cpp中,怎样调用CDocument::GetPathName  ???
      

  3.   

    GetDocument()->GetPathName();如果取到的路径在硬盘上不存在就没保存。
      

  4.   

    MFC Library Reference  CDocument::GetPathNameCall this function to get the fully qualified path of the document's disk file.
     
    const CString& GetPathName( ) const;Return ValueThe document's fully qualified path. This string is empty if the document has not been saved or does not have a disk file associated with it.
    我查了一下MSDN...
    3Q,Hendy_So(横笛).......