forked from GLDsuh-a/qt-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgressDlg.h
89 lines (61 loc) · 1.76 KB
/
ProgressDlg.h
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
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
--*/
#ifndef __PROGRESSDLG__
#define __PROGRESSDLG__
namespace WiaWrap
{
//////////////////////////////////////////////////////////////////////////
//
// CProgressDlg
//
/*++
CProgressDlg implements a simple progress dialog with a status message,
progress bar and a cancel button. The dialog is created in a separate
thread so that it remains responsive to the user while the main thread
is busy with a long operation. It is descended from IUnknown for
reference counting.
Methods
CProgressDlg
Creates a new thread that will display the progress dialog
~CProgressDlg
Closes the progress dialog
Cancelled
Returns TRUE if the user has pressed the cancel button.
SetTitle
Sets the title of the progress dialog.
SetMessage
Sets the status message.
SetPercent
Sets the progress bar position.
ThreadProc
Creates the dialog box
DialogProc
Processes window messages.
--*/
class CProgressDlg : public IUnknown
{
public:
CProgressDlg(HWND hWndParent);
~CProgressDlg();
// IUnknown interface
STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
// CProgressDlg methods
BOOL Cancelled() const;
VOID SetTitle(PCTSTR pszTitle);
VOID SetMessage(PCTSTR pszMessage);
VOID SetPercent(UINT nPercent);
private:
static DWORD WINAPI ThreadProc(PVOID pParameter);
static INT_PTR CALLBACK DialogProc(HWND, UINT, WPARAM, LPARAM);
private:
LONG m_cRef;
HWND m_hDlg;
HWND m_hWndParent;
LONG m_bCancelled;
HANDLE m_hInitDlg;
};
}; // namespace WiaWrap
#endif //__PROGRESSDLG__