-
Notifications
You must be signed in to change notification settings - Fork 9
/
CreateProgressDialog.cpp
123 lines (102 loc) · 2.87 KB
/
CreateProgressDialog.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "stdafx.h"
#include "CDM.h"
#include "CreateProgressDialog.h"
#include "Setting.h"
#include "Mmsystem.h"
#include "MessageDialog.h"
IMPLEMENT_DYNAMIC(CCreateProgressDialog, CDialog)
CCreateProgressDialog::CCreateProgressDialog(CWnd* pParent /*=NULL*/)
: CDialog(IDD, pParent)
, m_Message(_T(""))
, m_Percent(_T(""))
{
}
CCreateProgressDialog::~CCreateProgressDialog()
{
}
void CCreateProgressDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_MESSAGE, m_Message);
DDX_Control(pDX, IDCANCEL, m_CancelButton);
DDX_Control(pDX, IDC_PROGRESS, m_Progress);
DDX_Text(pDX, PERCENT, m_Percent);
}
BEGIN_MESSAGE_MAP(CCreateProgressDialog, CDialog)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
ON_COMMAND(ID_WINDOW_CLOSE, OnWindowClose)
ON_BN_CLICKED(IDC_LOG, OnBnClickedLog)
ON_COMMAND(ID_UPDATE_DIALOG, OnUpdateDialog)
END_MESSAGE_MAP()
void CCreateProgressDialog::OnBnClickedOk()
{
// OnOK();
}
void CCreateProgressDialog::CreateIso(LPCSTR ImgFileName, LPCSTR VolumeLabel, CListCtrl* List, CDirStructure* Dir,
CLogWindow* LogWnd)
{
m_Thread.m_FileName = ImgFileName;
m_Thread.m_TrackList = List;
m_Thread.m_Dir = Dir;
m_Thread.m_ParentWnd = this;
m_Thread.m_VolumeLabel = VolumeLabel;
m_Thread.m_LogWnd = LogWnd;
DoModal();
}
BOOL CCreateProgressDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_Thread.StartThread();
m_Progress.SetRange(0, 100);
SetWindowText(theSetting.m_Lang.m_Str[LP_CREATEP + 0]);
this->SetDlgItemText(IDC_LOG, theSetting.m_Lang.m_Str[LP_CREATEP + 1]);
this->SetDlgItemText(IDCANCEL, theSetting.m_Lang.m_Str[LP_CREATEP + 2]);
return TRUE; // return TRUE unless you set the focus to a control
}
void CCreateProgressDialog::OnBnClickedCancel()
{
// m_Thread.StopThread();
// OnCancel();
m_Thread.m_StopFlag = true;
}
void CCreateProgressDialog::OnWindowClose()
{
CMessageDialog dlg;
if (!m_Thread.m_StopFlag)
{
if (m_Thread.m_Success)
{
if (theSetting.m_WavOnSuccess != "")
{
PlaySound(theSetting.m_WavOnSuccess, nullptr, SND_ASYNC);
}
dlg.MessageBox(CONF_MSG, MSG(60));
}
else
{
if (theSetting.m_WavOnFail != "")
{
PlaySound(theSetting.m_WavOnFail, nullptr, SND_ASYNC);
}
dlg.MessageBox(CONF_MSG, MSG(61));
}
}
m_Thread.StopThread();
OnCancel();
}
void CCreateProgressDialog::OnBnClickedLog()
{
if (m_Thread.m_LogWnd->GetStyle() & 0x10000000)
{
m_Thread.m_LogWnd->ShowWindow(SW_HIDE);
}
else
{
m_Thread.m_LogWnd->ShowWindow(SW_SHOW);
}
}
void CCreateProgressDialog::OnUpdateDialog()
{
UpdateData(FALSE);
}