char CurrentDirectory[MAX_PATH];
CString fileName = "*.obj"; //默认打开的文件名
CString FilePathName;
CString Directory;
CString SaveFileName;
int ret = GetCurrentDirectory(MAX_PATH,CurrentDirectory);
Directory.Format(_T("%s"),CurrentDirectory);
SaveFileName = Directory + _T("\\test.obj");
CString filter = "文件 (*.obj)|*.obj||"; //文件过虑的类型
CFileDialog openFileDlg(TRUE, NULL, fileName, OFN_HIDEREADONLY|OFN_READONLY, filter, NULL);
if(openFileDlg.DoModal()==IDOK)
{
FilePathName = openFileDlg.GetPathName(); //文件名保存在了FilePathName里
CopyFile(FilePathName, SaveFileName ,FALSE);
}
else
{
return;
}
MFC选择文件并保存到当前路径
最新推荐文章于 2021-03-04 11:47:05 发布