-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathNewFolderDlg.cpp
103 lines (79 loc) · 2.2 KB
/
NewFolderDlg.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// NewFolderDlg.cpp : implementation file
//
#include "stdafx.h"
#include "myget.h"
#include "NewFolderDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewFolderDlg dialog
CNewFolderDlg::CNewFolderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewFolderDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewFolderDlg)
m_strCurrentFolderName = _T("");
m_strNewFolderName = _T("");
//}}AFX_DATA_INIT
}
void CNewFolderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewFolderDlg)
DDX_Text(pDX, IDC_TEXT_CURRENT_FOLDER, m_strCurrentFolderName);
DDX_Text(pDX, IDC_EDT_NEW_FOLDER_NAME, m_strNewFolderName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewFolderDlg, CDialog)
//{{AFX_MSG_MAP(CNewFolderDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewFolderDlg message handlers
void CNewFolderDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
if (m_strNewFolderName.IsEmpty())
{
return;
}
m_strNewPath = m_strCurrentFolderName;
if (m_strNewPath.ReverseFind(TCHAR('\\')) != m_strNewPath.GetLength() - 1)
{
m_strNewPath += "\\";
}
m_strNewPath += m_strNewFolderName;
if (!CreateDirectory(m_strNewPath, NULL))
{
CString strError;
strError.LoadString(IDS_COULD_CREATE_FOLDER);
MessageBox(strError, NULL, MB_ICONERROR | MB_OK);
return;
}
CDialog::OnOK();
}
void CNewFolderDlg::ReloadResource()
{
//common
//SetDlgItemText(1, APP_GET_RSCSTR("Dialog_Common", 1));
//SetDlgItemText(2, APP_GET_RSCSTR("Dialog_Common", 2));
SET_DLG_ITEM_TEXT_EX(1, "Dialog_Common", 1);
SET_DLG_ITEM_TEXT_EX(2, "Dialog_Common", 2);
//Dlg Items
LPCTSTR lpszDlgID = _T("NewFolder_Dlg");
//SetWindowText(APP_GET_RSCSTR(lpszDlgID, "Title"));
SET_WINDOW_TITLE;
SET_DLG_ITEM_TEXT(1197);
SET_DLG_ITEM_TEXT(1198);
}
BOOL CNewFolderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ReloadResource();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}