forked from keizi666/charu3
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommonDialog.cpp
41 lines (38 loc) · 1.28 KB
/
commonDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "stdafx.h"
#include "commonDialog.h"
#include "resource.h"
CString CommonDialog::NewFilePath(LPCWSTR ext)
{
CString strTitle, strDisplay, strPattern;
(void)strTitle.LoadString(APP_INF_EXPORT_CAPTION);
(void)strDisplay.LoadString(APP_INF_FILE_FILTER_C3D_DISPLAY);
(void)strPattern.LoadString(APP_INF_FILE_FILTER_C3D_PATTERN);
CString strFilter = strDisplay + _T('\0') + strPattern + _T('\0') + _T('\0') + _T('\0');
OPENFILENAME param;
ZeroMemory(¶m, sizeof param);
TCHAR tcPath[MAX_PATH] = _T("");
param.lStructSize = sizeof param;
param.hwndOwner = NULL;
param.lpstrTitle = strTitle.GetBuffer();
param.lpstrFilter = strFilter.GetBuffer();
param.lpstrDefExt = ext;
param.lpstrCustomFilter = NULL;
param.nFilterIndex = 1;
param.lpstrFile = tcPath;
param.nMaxFile = MAX_PATH;
param.lpstrFileTitle = NULL;
param.lpstrInitialDir = NULL;
param.Flags = OFN_OVERWRITEPROMPT;
param.nFileOffset = 0;
param.nFileExtension = 0;
if (GetSaveFileName(¶m)) {
//if (param.Flags & OFN_EXTENSIONDIFFERENT) {
// _tcscat_s(tcPath, MAX_PATH, _T("."));
// _tcscat_s(tcPath, MAX_PATH, _T(DAT_EXT));
//}
return CString(tcPath);
}
else {
return CString(_T(""));
}
}