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_TRIGGER_FLAG_HAS_END_DATE 0x1")
59 cpp_quote("#define TASK_TRIGGER_FLAG_KILL_AT_DURATION_END 0x2")
60 cpp_quote("#define TASK_TRIGGER_FLAG_DISABLED 0x4")
65 uuid(148BD528-A2AB-11CE-B11F-00AA00530503),
66 pointer_default(unique)
68 interface IEnumWorkItems : IUnknown
72 [out] LPWSTR **rgpwszNames,
73 [out] ULONG *pceltFetched);
81 [out] IEnumWorkItems **ppEnumWorkItems);
84 cpp_quote("#ifndef _HPROPSHEETPAGE_DEFINED")
85 typedef struct _PSP *HPROPSHEETPAGE;
86 cpp_quote("#define _HPROPSHEETPAGE_DEFINED")
92 uuid(4086658a-cbbb-11cf-b604-00c04fd8d565),
93 pointer_default(unique)
95 interface IProvideTaskPage : IUnknown
97 typedef enum _TASKPAGE {
99 TASKPAGE_SCHEDULE = 1,
100 TASKPAGE_SETTINGS = 2
104 [in] TASKPAGE tpType,
105 [in] BOOL fPersistChanges,
106 [out] HPROPSHEETPAGE *phPage);
112 uuid(148BD52B-A2AB-11CE-B11F-00AA00530503),
113 pointer_default(unique)
115 interface ITaskTrigger : IUnknown
117 typedef enum _TASK_TRIGGER_TYPE {
118 TASK_TIME_TRIGGER_ONCE = 0,
119 TASK_TIME_TRIGGER_DAILY = 1,
120 TASK_TIME_TRIGGER_WEEKLY = 2,
121 TASK_TIME_TRIGGER_MONTHLYDATE = 3,
122 TASK_TIME_TRIGGER_MONTHLYDOW = 4,
123 TASK_EVENT_TRIGGER_ON_IDLE = 5,
124 TASK_EVENT_TRIGGER_AT_SYSTEMSTART = 6,
125 TASK_EVENT_TRIGGER_AT_LOGON = 7
126 } TASK_TRIGGER_TYPE, *PTASK_TRIGGER_TYPE;
128 typedef struct _DAILY {
132 typedef struct _WEEKLY {
134 WORD rgfDaysOfTheWeek;
137 typedef struct _MONTHLYDATE {
142 typedef struct _MONTHLYDOW {
144 WORD rgfDaysOfTheWeek;
148 typedef union _TRIGGER_TYPE_UNION {
151 MONTHLYDATE MonthlyDate;
152 MONTHLYDOW MonthlyDOW;
153 } TRIGGER_TYPE_UNION;
155 typedef struct _TASK_TRIGGER {
166 DWORD MinutesDuration;
167 DWORD MinutesInterval;
169 TASK_TRIGGER_TYPE TriggerType;
170 TRIGGER_TYPE_UNION Type;
172 WORD wRandomMinutesInterval;
173 } TASK_TRIGGER, *PTASK_TRIGGER;
176 [in] const PTASK_TRIGGER pTrigger);
179 [out] PTASK_TRIGGER pTrigger);
181 HRESULT GetTriggerString(
182 [out] LPWSTR *ppwszTrigger);
188 uuid(a6b952f0-a4b1-11d0-997d-00aa006887ec),
189 pointer_default(unique)
191 interface IScheduledWorkItem : IUnknown
193 HRESULT CreateTrigger(
194 [out] WORD *piNewTrigger,
195 [out] ITaskTrigger **ppTrigger);
197 HRESULT DeleteTrigger(
200 HRESULT GetTriggerCount(
201 [out] WORD *plCount);
205 [out] ITaskTrigger **ppTrigger);
207 HRESULT GetTriggerString(
209 [out] LPWSTR *ppwszTrigger);
212 [in] const LPSYSTEMTIME pstBegin,
213 [in] const LPSYSTEMTIME pstEnd,
214 [in, out] WORD *pCount,
215 [out] LPSYSTEMTIME *rgstTaskTimes);
217 HRESULT GetNextRunTime(
218 [out] SYSTEMTIME *pstNextRun);
221 [in] WORD wIdleMinutes,
222 [in] WORD wDeadlineMinutes);
225 [out] WORD *pwIdleMinutes,
226 [out] WORD *pwDeadlineMinutes);
232 HRESULT EditWorkItem(
234 [in] DWORD dwReserved);
236 HRESULT GetMostRecentRunTime(
237 [out] SYSTEMTIME *pstLastRun);
240 [out] HRESULT *phrStatus);
243 [out] DWORD *pdwExitCode);
246 [in] LPCWSTR pwszComment);
249 [out] LPWSTR *ppwszComment);
252 LPCWSTR pwszCreator);
255 [out] LPWSTR *ppwszCreator);
257 HRESULT SetWorkItemData(
259 [in] BYTE rgbData[]);
261 HRESULT GetWorkItemData(
263 [out] BYTE **ppBytes);
265 HRESULT SetErrorRetryCount(
268 HRESULT GetErrorRetryCount(
269 [out] WORD *pwRetryCount);
271 HRESULT SetErrorRetryInterval(
272 WORD wRetryInterval);
274 HRESULT GetErrorRetryInterval(
275 [out] WORD *pwRetryInterval);
281 [out] DWORD *pdwFlags);
283 HRESULT SetAccountInformation(
284 [in] LPCWSTR pwszAccountName,
285 [in] LPCWSTR pwszPassword);
287 HRESULT GetAccountInformation(
288 [out] LPWSTR *ppwszAccountName);
294 uuid(148BD524-A2AB-11CE-B11F-00AA00530503),
295 pointer_default(unique)
297 interface ITask : IScheduledWorkItem
299 HRESULT SetApplicationName(
300 [in] LPCWSTR pwszApplicationName);
302 HRESULT GetApplicationName(
303 [out] LPWSTR *ppwszApplicationName);
305 HRESULT SetParameters(
306 [in] LPCWSTR pwszParameters);
308 HRESULT GetParameters(
309 [out] LPWSTR *ppwszParameters);
311 HRESULT SetWorkingDirectory(
312 [in] LPCWSTR pwszWorkingDirectory);
314 HRESULT GetWorkingDirectory(
315 [in] LPWSTR *ppwszWorkingDirectory);
318 [in] DWORD dwPriority);
321 [out] DWORD *pdwPriority);
323 HRESULT SetTaskFlags(
326 HRESULT GetTaskFlags(
327 [out] DWORD *pdwFlags);
329 HRESULT SetMaxRunTime(
330 [in] DWORD dwMaxRunTime);
332 HRESULT GetMaxRunTime(
333 [out] DWORD *pdwMaxRunTime);
339 uuid(148BD527-A2AB-11CE-B11F-00AA00530503),
340 pointer_default(unique)
342 interface ITaskScheduler : IUnknown
344 HRESULT SetTargetComputer(
345 [in] LPCWSTR pwszComputer);
347 HRESULT GetTargetComputer(
348 [out] LPWSTR *ppwszComputer);
351 [out] IEnumWorkItems **ppEnumTasks);
354 [in] LPCWSTR pwszName,
356 [out] IUnknown **ppunk);
359 [in] LPCWSTR pwszName);
362 [in] LPCWSTR pwszTaskName,
363 [in] REFCLSID rclsid,
365 [out] IUnknown **ppunk);
368 [in] LPCWSTR pwszTaskName,
369 [in] IScheduledWorkItem *pWorkItem);
372 [in] LPCWSTR pwszName,
378 uuid(148BD52A-A2AB-11CE-B11F-00AA00530503)
380 coclass CTaskScheduler
382 [default] interface ITaskScheduler;
388 uuid(148BD520-A2AB-11CE-B11F-00AA00530503)
392 [default] interface ITask;