用GetSaveFileName()函数。The GetSaveFileName function creates a Save dialog box that lets the user specify the drive, directory, and name of a file to save. BOOL GetSaveFileName( LPOPENFILENAME lpofn // initialization data ); Parameters lpofn [in/out] Pointer to an OPENFILENAME structure that contains information used to initialize the dialog box. When GetSaveFileName returns, this structure contains information about the user's file selection.
CFileDialog dlg(FALSE);
if(dlg.DoModal()==IDOK)
Filename=dlg.GetFileName();
bVal=TRUE:打开
=FALSE:保存
LPOPENFILENAME lpofn // initialization data
);
Parameters
lpofn
[in/out] Pointer to an OPENFILENAME structure that contains information used to initialize the dialog box. When GetSaveFileName returns, this structure contains information about the user's file selection.