使用cfiledialog打开一个文件(另存为),有时候是新建一个,有时候是要替换前一个,我怎么判断是属于那种?

解决方案 »

  1.   

    CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
    第一个参数bOpenFileDialog设置为TRUE的时候是打开文件对话框, FALSE就是另存对话框了,根据设置就可以判断控制!
      

  2.   

    CFileDialog::CFileDialog
    CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );ParametersbOpenFileDialogSet to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.
      

  3.   

    感谢两位,您没明白我的意思,我是在设置bOpenFileDialog为false的时候,when i get a file ,how could i know whether it is just created or already existed.