- void COpenSaveFileDialogDlg::OnBnClickedButtonOpen()
- {
- BOOL isOpen = TRUE;
- CString defaultDir = L"E:\\FileTest";
- CString fileName = L"";
- CString filter = L"文件 (*.doc; *.ppt; *.xls)|*.doc;*.ppt;*.xls||";
- CFileDialog openFileDlg(isOpen, defaultDir, fileName, OFN_HIDEREADONLY|OFN_READONLY, filter, NULL);
- openFileDlg.GetOFN().lpstrInitialDir = L"E:\\FileTest\\test.doc";
- INT_PTR result = openFileDlg.DoModal();
- CString filePath = defaultDir + "\\test.doc";
- if(result == IDOK) {
- filePath = openFileDlg.GetPathName();
- }
- CWnd::SetDlgItemTextW(IDC_EDIT_SRC, filePath);
- }
-
- void COpenSaveFileDialogDlg::OnBnClickedButtonSave()
- {
- BOOL isOpen = FALSE;
- CString defaultDir = L"E:\\FileTest";
- CString fileName = L"test.doc";
- CString filter = L"文件 (*.doc; *.ppt; *.xls)|*.doc;*.ppt;*.xls||";
- CFileDialog openFileDlg(isOpen, defaultDir, fileName, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, filter, NULL);
- openFileDlg.GetOFN().lpstrInitialDir = L"E:\\FileTest\\test.doc";
- INT_PTR result = openFileDlg.DoModal();
- CString filePath = defaultDir + "\\" + fileName;
- if(result == IDOK) {
- filePath = openFileDlg.GetPathName();
- }
- CWnd::SetDlgItemTextW(IDC_EDIT_DEST, filePath);
posted @
2016-06-01 17:51
投机者
阅读(
4812)
评论()
编辑
收藏
举报