Repository navigation
Expand file tree
/
Copy pathCheckExportDlg.cpp
More file actions
135 lines (108 loc) · 3.43 KB
/
Copy pathCheckExportDlg.cpp
File metadata and controls
135 lines (108 loc) · 3.43 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// CheckExportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "burntool.h"
#include "CheckExportDlg.h"
#include "Update.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCheckExportDlg dialog
extern CConfig theConfig;
extern CBurnToolApp theApp;
CCheckExportDlg::CCheckExportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCheckExportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCheckExportDlg)
// NOTE: the ClassWizard will add member initialization here
m_str_check_export = _T("");
//}}AFX_DATA_INIT
}
void CCheckExportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCheckExportDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Text(pDX, IDC_EDIT_CHECK_STRING, m_str_check_export);
DDV_MaxChars(pDX, m_str_check_export, 10);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCheckExportDlg, CDialog)
//{{AFX_MSG_MAP(CCheckExportDlg)
ON_EN_CHANGE(IDC_EDIT_CHECK_STRING, OnChangeEditCheckString)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCheckExportDlg message handlers
void CCheckExportDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
TCHAR szFilter[] = TEXT("Update Files(*.upd)|*.upd|") \
TEXT("All Files (*.*)|*.*||") ;
CFileDialog fd(FALSE, _T(".upd"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
szFilter, NULL);
if(IDOK == fd.DoModal())
{
CString strPath = fd.GetPathName();
CUpdate update;
HWND hDlg = CreateWindow(_T("BUTTON"),
theApp.GetString(IDS_MSG_WAIT),
WS_VISIBLE|BS_PUSHBUTTON,
GetSystemMetrics(SM_CXSCREEN)/2 - 100,
GetSystemMetrics(SM_CYSCREEN)/2 - 50 ,
200,
NULL,
GetSafeHwnd(),
NULL,
AfxGetInstanceHandle(),
NULL);
if(update.ExportUpdateFile(&theConfig, strPath, m_str_check_export))
{
::DestroyWindow(hDlg);
AfxMessageBox(theApp.GetString(IDS_MSG_UPD_EXPORT_SUCCESS));
}
else
{
CFileFind fd_p;
if(fd_p.FindFile(theApp.ConvertAbsolutePath(strPath)))
{
DeleteFile(theApp.ConvertAbsolutePath(strPath));
}
::DestroyWindow(hDlg);
AfxMessageBox(theApp.GetString(IDS_MSG_UPD_EXPORT_FAIL));
}
}
CDialog::OnOK();
}
void CCheckExportDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CCheckExportDlg::OnChangeEditCheckString()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
BOOL CCheckExportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString strTitle;
CString str;
str = theApp.GetString(IDS_OK);
GetDlgItem(IDOK)->SetWindowText(str);
str = theApp.GetString(IDS_CANCEL);
GetDlgItem(IDCANCEL)->SetWindowText(str);
strTitle = theApp.GetString(IDS_CHECK_EXPORT_DIALOG);
SetWindowText(strTitle);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}