-
Notifications
You must be signed in to change notification settings - Fork 1
/
FileDialogEx.cpp
50 lines (39 loc) · 1.4 KB
/
FileDialogEx.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
42
43
44
45
46
47
48
49
50
// FileDialogEx.cpp : implementation file
//
#include "pch.h"
#include "framework.h"
#include "FileDialogEx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileDialogEx
IMPLEMENT_DYNAMIC(CFileDialogEx, CFileDialog)
CFileDialogEx::CFileDialogEx(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
StartVisualGroup(IDS_GROUP_SEPARATOR, CString(_T("CSV S&eparator")));
AddEditBox(IDS_EDIT_SEPARATOR,
AfxGetApp()->GetProfileString(_T("Settings"), _T("CSVSeparator"), _T(",")));
EndVisualGroup();
}
BEGIN_MESSAGE_MAP(CFileDialogEx, CFileDialog)
//{{AFX_MSG_MAP(CFileDialogEx)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CFileDialogEx::OnFileNameOK()
{
// TODO: Add your specialized code here and/or call the base class
CString sText;
GetEditBoxText(IDS_EDIT_SEPARATOR, sText);
if (sText.IsEmpty())
return TRUE;
const CString sTextOrg = AfxGetApp()->GetProfileString(_T("Settings"), _T("CSVSeparator"), _T(","));
if (sText != sTextOrg)
AfxGetApp()->WriteProfileString(_T("Settings"), _T("CSVSeparator"), sText);
return CFileDialog::OnFileNameOK();
}