我想通过一个对话框设置一个保存文件的路径,也就时获取一个文件夹的绝对路径,而非一个文件的路径,打个比方就是好像下载文件我要设置一个下载的文件夹一样。然后后面编程时用到,用CFileDialog能实现吗?谢谢各位了!

解决方案 »

  1.   

    CFileDialog::GetFolderPathSee Also
    CFileDialog Overview | Class Members | Hierarchy Chart | CDM_GETFOLDERPATH
    Call this member function to retrieve the path of the currently open folder or directory for an Explorer-style Open or Save As common dialog box.CString GetFolderPath( ) const;
    Return Value
    A CString object containing the currently open folder or directory.Res
    The dialog box must have been created with the OFN_EXPLORER style; otherwise, the function will fail with an assertion.
      

  2.   

    GetFolderPath不行啊,用CfileDialog对话框打开不是有一个打开按钮吗?必须要选择文件以后才能打开,这实话获取就是文件的路径了!