-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathOperationsProgressDialog.ahk
209 lines (174 loc) · 5.78 KB
/
OperationsProgressDialog.ahk
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
class: OperationsProgressDialog
wraps the *IOperationsProgressDialog* interface and exposes methods to get, set, and query a progress dialog.
Authors:
- maul.esel (https://github.com/maul-esel)
License:
- *LGPL* (http://www.gnu.org/licenses/lgpl-2.1.txt)
Documentation:
- *class documentation* (http://maul-esel.github.com/COM-Classes/master/OperationsProgressDialog)
- *msdn* (http://msdn.microsoft.com/en-us/library/windows/desktop/bb775368)
Requirements:
AutoHotkey - AHK v2 alpha
OS - Windows 2000 Professional, Windows XP, Windows 2000 Server or higher
Base classes - _CCF_Error_Handler_, Unknown
Constant classes - PROGDLG, PDOPSTATUS, PMODE
*/
class OperationsProgressDialog extends Unknown
{
/*
Field: CLSID
This is CLSID_ProgressDialog. It is required to create an instance.
*/
static CLSID := "{F8383852-FCD3-11d1-A6B9-006097DF5BD4}"
/*
Field: IID
This is IID_IOperationsProgressDialog. It is required to create an instance.
*/
static IID := "{0C9FB851-E5C9-43EB-A370-F0677B13874C}"
/*
Method: StartProgressDialog
Starts the progress dialog.
Parameters:
[opt] UINT flags - a combination fo flags modifying the dialog. You can use the fields of the PROGDLG class for convenience.
[opt] HWND hParent - the handle to the parent window
Returns:
BOOL success - true on success, false otherwise
*/
StartProgressDialog(flags := 0, hParent := 0)
{
return this._Error(DllCall(NumGet(this.vt+03*A_PtrSize), "Ptr", this.ptr, "UInt", hParent, "Uint", flags))
}
/*
Method: StopProgressDialog
Stops the progress dialog.
Returns:
BOOL success - true on success, false otherwise
*/
StopProgressDialog()
{
return this._Error(DllCall(NumGet(this.vt+04*A_PtrSize), "Ptr", this.ptr))
}
/*
Method: SetOperation
Sets which progress dialog operation is occurring.
Parameters:
UINT operation - the operation to perform. You can use the fields of the SPACTION class for convenience.
Returns:
BOOL success - true on success, false otherwise
*/
SetOperation(operation)
{
return this._Error(DllCall(NumGet(this.vt+05*A_PtrSize), "Ptr", this.ptr, "UInt", operation))
}
/*
Method: SetMode
Sets progress dialog operations mode.
Parameters:
UINT mode - the operation mode. You can use the fields of the PMODE class for convenience.
Returns:
BOOL success - true on success, false otherwise
*/
SetMode(mode)
{
return this._Error(DllCall(NumGet(this.vt+06*A_PtrSize), "Ptr", this.ptr, "Uint", mode))
}
/*
Method: UpdateProgress
Parameters:
int pointsReached - Current points, used for showing progress in points. (progressbar)
int pointsTotal - Total points, used for showing progress in points.
int sizeReached - Current size in bytes, used for showing progress in bytes.
int sizeTotal - total size in bytes, used for showing progress in bytes.
int itemsReached - Current items, used for showing progress in items.
int itemsTotal - Specifies total items, used for showing progress in items.
Returns:
BOOL success - true on success, false otherwise
*/
UpdateProgress(pointsReached, pointsTotal, sizeReached, sizeTotal, itemsReached, itemsTotal)
{
return this._Error(DllCall(NumGet(this.vt+07*A_PtrSize), "Ptr", this.ptr
, "Uint64", pointsReached
, "Uint64", pointsTotal
, "UInt64", sizeReached
, "UInt64", sizeTotal
, "Uint64", itemsReached
, "Uint64", itemsTotal))
}
/*
Method: UpdateLocations
Called to specify the text elements stating the source and target in the current progress dialog.
Parameters:
IShellItem source - the pointer to an IShellItem that represents the source Shell item.
IShellItem target - the pointer to an IShellItem that represents the target Shell item.
[opt] IShellItem item - *Win7 and later:* A pointer to an IShellItem that represents the item currently being operated on by the operation engine.
Returns:
BOOL success - true on success, false otherwise
Remarks:
You can either pass raw pointers or ShellItem instances to this method.
*/
UpdateLocations(source, target, item := 0)
{
return this._Error(DllCall(NumGet(this.vt+08*A_PtrSize), "Ptr", this.ptr
, "Ptr", IsObject(source) ? source.ptr : source
, "Ptr", IsObject(target) ? target.ptr : target
, "Ptr", IsObject(item) ? item.ptr : item))
}
/*
Method: ResetTimer
Resets progress dialog timer to 0.
Returns:
BOOL success - true on success, false otherwise
*/
ResetTimer()
{
return this._Error(DllCall(NumGet(this.vt+09*A_PtrSize), "Ptr", this.ptr))
}
/*
Method: PauseTimer
Pauses progress dialog timer.
Returns:
BOOL success - true on success, false otherwise
*/
PauseTimer()
{
return this._Error(DllCall(NumGet(this.vt+10*A_PtrSize), "Ptr", this.ptr))
}
/*
Method: ResumeTimer
Resumes progress dialog timer.
Returns:
BOOL success - true on success, false otherwise
*/
ResumeTimer()
{
return this._Error(DllCall(NumGet(this.vt+11*A_PtrSize), "Ptr", this.ptr))
}
/*
Method: GetMilliseconds
Gets elapsed and remaining time for progress dialog.
Parameters:
byref INT elapsed - the elapsed time in milliseconds
byref INT remaining - the remaining time in milliseconds
Returns:
BOOL success - true on success, false otherwise
*/
GetMilliseconds(ByRef elapsed, ByRef remaining)
{
return this._Error(DllCall(NumGet(this.vt+12*A_PtrSize), "Ptr", this.ptr, "UInt64*", elapsed, "UInt64*", remaining))
}
/*
Method: GetOperationStatus
Gets operation status for progress dialog.
Returns:
UINT status - the dialog's status. You can compare it to the members of the PDOPSTATUS class.
Remarks:
- To get information about success and failure of this method, check the instance's Error object.
*/
GetOperationStatus()
{
local status
this._Error(DllCall(NumGet(this.vt+13*A_PtrSize), "Ptr", this.ptr, "UInt*", status))
return status
}
}