2 * Task Scheduler Service interface
4 * Copyright (C) 2008 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #define threading
(model
)
28 #define vi_progid
(str
)
31 cpp_quote
("#define TASK_SUNDAY 0x1")
32 cpp_quote
("#define TASK_MONDAY 0x2")
33 cpp_quote
("#define TASK_TUESDAY 0x4")
34 cpp_quote
("#define TASK_WEDNESDAY 0x8")
35 cpp_quote
("#define TASK_THURSDAY 0x10")
36 cpp_quote
("#define TASK_FRIDAY 0x20")
37 cpp_quote
("#define TASK_SATURDAY 0x40")
39 cpp_quote
("#define TASK_FIRST_WEEK 1")
40 cpp_quote
("#define TASK_SECOND_WEEK 2")
41 cpp_quote
("#define TASK_THIRD_WEEK 3")
42 cpp_quote
("#define TASK_FOURTH_WEEK 4")
43 cpp_quote
("#define TASK_LAST_WEEK 5")
45 cpp_quote
("#define TASK_JANUARY 0x1")
46 cpp_quote
("#define TASK_FEBRUARY 0x2")
47 cpp_quote
("#define TASK_MARCH 0x4")
48 cpp_quote
("#define TASK_APRIL 0x8")
49 cpp_quote
("#define TASK_MAY 0x10")
50 cpp_quote
("#define TASK_JUNE 0x20")
51 cpp_quote
("#define TASK_JULY 0x40")
52 cpp_quote
("#define TASK_AUGUST 0x80")
53 cpp_quote
("#define TASK_SEPTEMBER 0x100")
54 cpp_quote
("#define TASK_OCTOBER 0x200")
55 cpp_quote
("#define TASK_NOVEMBER 0x400")
56 cpp_quote
("#define TASK_DECEMBER 0x800")
58 cpp_quote
("#define TASK_FLAG_INTERACTIVE 0x0001")
59 cpp_quote
("#define TASK_FLAG_DELETE_WHEN_DONE 0x0002")
60 cpp_quote
("#define TASK_FLAG_DISABLED 0x0004")
61 cpp_quote
("#define TASK_FLAG_START_ONLY_IF_IDLE 0x0010")
62 cpp_quote
("#define TASK_FLAG_KILL_ON_IDLE_END 0x0020")
63 cpp_quote
("#define TASK_FLAG_DONT_START_IF_ON_BATTERIES 0x0040")
64 cpp_quote
("#define TASK_FLAG_KILL_IF_GOING_ON_BATTERIES 0x0080")
65 cpp_quote
("#define TASK_FLAG_RUN_ONLY_IF_DOCKED 0x0100")
66 cpp_quote
("#define TASK_FLAG_HIDDEN 0x0200")
67 cpp_quote
("#define TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET 0x0400")
68 cpp_quote
("#define TASK_FLAG_RESTART_ON_IDLE_RESUME 0x0800")
69 cpp_quote
("#define TASK_FLAG_SYSTEM_REQUIRED 0x1000")
70 cpp_quote
("#define TASK_FLAG_RUN_ONLY_IF_LOGGED_ON 0x2000")
72 cpp_quote
("#define TASK_TRIGGER_FLAG_HAS_END_DATE 0x1")
73 cpp_quote
("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2")
74 cpp_quote
("#define TASK_TRIGGER_FLAG_DISABLED 0x4")
79 uuid(148BD528
-A2AB
-11CE
-B11F
-00AA00530503
),
80 pointer_default(unique)
82 interface IEnumWorkItems
: IUnknown
86 [out] LPWSTR
**rgpwszNames
,
87 [out] ULONG
*pceltFetched
);
95 [out] IEnumWorkItems
**ppEnumWorkItems
);
98 cpp_quote
("#ifndef _HPROPSHEETPAGE_DEFINED")
99 typedef struct _PSP
*HPROPSHEETPAGE
;
100 cpp_quote
("#define _HPROPSHEETPAGE_DEFINED")
106 uuid(4086658a
-cbbb
-11cf
-b604
-00c04fd8d565
),
107 pointer_default(unique)
109 interface IProvideTaskPage
: IUnknown
111 typedef enum _TASKPAGE
{
113 TASKPAGE_SCHEDULE
= 1,
114 TASKPAGE_SETTINGS
= 2
118 [in] TASKPAGE tpType
,
119 [in] BOOL fPersistChanges
,
120 [out] HPROPSHEETPAGE
*phPage
);
126 uuid(148BD52B
-A2AB
-11CE
-B11F
-00AA00530503
),
127 pointer_default(unique)
129 interface ITaskTrigger
: IUnknown
131 typedef enum _TASK_TRIGGER_TYPE
{
132 TASK_TIME_TRIGGER_ONCE
= 0,
133 TASK_TIME_TRIGGER_DAILY
= 1,
134 TASK_TIME_TRIGGER_WEEKLY
= 2,
135 TASK_TIME_TRIGGER_MONTHLYDATE
= 3,
136 TASK_TIME_TRIGGER_MONTHLYDOW
= 4,
137 TASK_EVENT_TRIGGER_ON_IDLE
= 5,
138 TASK_EVENT_TRIGGER_AT_SYSTEMSTART
= 6,
139 TASK_EVENT_TRIGGER_AT_LOGON
= 7
140 } TASK_TRIGGER_TYPE
, *PTASK_TRIGGER_TYPE
;
142 typedef struct _DAILY
{
146 typedef struct _WEEKLY
{
148 WORD rgfDaysOfTheWeek
;
151 typedef struct _MONTHLYDATE
{
156 typedef struct _MONTHLYDOW
{
158 WORD rgfDaysOfTheWeek
;
162 typedef union _TRIGGER_TYPE_UNION
{
165 MONTHLYDATE MonthlyDate
;
166 MONTHLYDOW MonthlyDOW
;
167 } TRIGGER_TYPE_UNION
;
169 typedef struct _TASK_TRIGGER
{
180 DWORD MinutesDuration
;
181 DWORD MinutesInterval
;
183 TASK_TRIGGER_TYPE TriggerType
;
184 TRIGGER_TYPE_UNION Type
;
186 WORD wRandomMinutesInterval
;
187 } TASK_TRIGGER
, *PTASK_TRIGGER
;
190 [in] const PTASK_TRIGGER pTrigger
);
193 [out] PTASK_TRIGGER pTrigger
);
195 HRESULT GetTriggerString
(
196 [out] LPWSTR
*ppwszTrigger
);
202 uuid(a6b952f0
-a4b1
-11d0
-997d
-00aa006887ec
),
203 pointer_default(unique)
205 interface IScheduledWorkItem
: IUnknown
207 HRESULT CreateTrigger
(
208 [out] WORD
*piNewTrigger
,
209 [out] ITaskTrigger
**ppTrigger
);
211 HRESULT DeleteTrigger
(
214 HRESULT GetTriggerCount
(
215 [out] WORD
*plCount
);
219 [out] ITaskTrigger
**ppTrigger
);
221 HRESULT GetTriggerString
(
223 [out] LPWSTR
*ppwszTrigger
);
226 [in] const LPSYSTEMTIME pstBegin
,
227 [in] const LPSYSTEMTIME pstEnd
,
228 [in, out] WORD
*pCount
,
229 [out] LPSYSTEMTIME
*rgstTaskTimes
);
231 HRESULT GetNextRunTime
(
232 [out] SYSTEMTIME
*pstNextRun
);
235 [in] WORD wIdleMinutes
,
236 [in] WORD wDeadlineMinutes
);
239 [out] WORD
*pwIdleMinutes
,
240 [out] WORD
*pwDeadlineMinutes
);
246 HRESULT EditWorkItem
(
248 [in] DWORD dwReserved
);
250 HRESULT GetMostRecentRunTime
(
251 [out] SYSTEMTIME
*pstLastRun
);
254 [out] HRESULT *phrStatus
);
257 [out] DWORD
*pdwExitCode
);
260 [in] LPCWSTR pwszComment
);
263 [out] LPWSTR
*ppwszComment
);
266 LPCWSTR pwszCreator
);
269 [out] LPWSTR
*ppwszCreator
);
271 HRESULT SetWorkItemData
(
273 [in] BYTE rgbData
[]);
275 HRESULT GetWorkItemData
(
277 [out] BYTE **ppBytes
);
279 HRESULT SetErrorRetryCount
(
282 HRESULT GetErrorRetryCount
(
283 [out] WORD
*pwRetryCount
);
285 HRESULT SetErrorRetryInterval
(
286 WORD wRetryInterval
);
288 HRESULT GetErrorRetryInterval
(
289 [out] WORD
*pwRetryInterval
);
295 [out] DWORD
*pdwFlags
);
297 HRESULT SetAccountInformation
(
298 [in] LPCWSTR pwszAccountName
,
299 [in] LPCWSTR pwszPassword
);
301 HRESULT GetAccountInformation
(
302 [out] LPWSTR
*ppwszAccountName
);
308 uuid(148BD524
-A2AB
-11CE
-B11F
-00AA00530503
),
309 pointer_default(unique)
311 interface ITask
: IScheduledWorkItem
313 HRESULT SetApplicationName
(
314 [in] LPCWSTR pwszApplicationName
);
316 HRESULT GetApplicationName
(
317 [out] LPWSTR
*ppwszApplicationName
);
319 HRESULT SetParameters
(
320 [in] LPCWSTR pwszParameters
);
322 HRESULT GetParameters
(
323 [out] LPWSTR
*ppwszParameters
);
325 HRESULT SetWorkingDirectory
(
326 [in] LPCWSTR pwszWorkingDirectory
);
328 HRESULT GetWorkingDirectory
(
329 [in] LPWSTR
*ppwszWorkingDirectory
);
332 [in] DWORD dwPriority
);
335 [out] DWORD
*pdwPriority
);
337 HRESULT SetTaskFlags
(
340 HRESULT GetTaskFlags
(
341 [out] DWORD
*pdwFlags
);
343 HRESULT SetMaxRunTime
(
344 [in] DWORD dwMaxRunTime
);
346 HRESULT GetMaxRunTime
(
347 [out] DWORD
*pdwMaxRunTime
);
353 uuid(148BD527
-A2AB
-11CE
-B11F
-00AA00530503
),
354 pointer_default(unique)
356 interface ITaskScheduler
: IUnknown
358 HRESULT SetTargetComputer
(
359 [in] LPCWSTR pwszComputer
);
361 HRESULT GetTargetComputer
(
362 [out] LPWSTR
*ppwszComputer
);
365 [out] IEnumWorkItems
**ppEnumTasks
);
368 [in] LPCWSTR pwszName
,
370 [out] IUnknown
**ppunk
);
373 [in] LPCWSTR pwszName
);
376 [in] LPCWSTR pwszTaskName
,
377 [in] REFCLSID rclsid
,
379 [out] IUnknown
**ppunk
);
382 [in] LPCWSTR pwszTaskName
,
383 [in] IScheduledWorkItem
*pWorkItem
);
386 [in] LPCWSTR pwszName
,
392 uuid(148BD52A
-A2AB
-11CE
-B11F
-00AA00530503
)
394 coclass CTaskScheduler
396 [default] interface ITaskScheduler
;
402 uuid(148BD520
-A2AB
-11CE
-B11F
-00AA00530503
)
406 [default] interface ITask
;