PageRenderTime 83ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Win32/Source/Taskschd.pas

https://github.com/ricardoarruda/MySQL-Front
Pascal | 848 lines | 774 code | 68 blank | 6 comment | 0 complexity | 557ff25812761fd0d3cfb5466e74033c MD5 | raw file
  1. unit Taskschd;
  2. {***************************************************
  3. * *
  4. * Microsoft Windows TaskScheduler API v.2.0 *
  5. * for Delphi *
  6. * *
  7. ***************************************************}
  8. interface
  9. uses
  10. Windows, ActiveX;
  11. const
  12. TaskSchedulerMajorVersion = 2;
  13. TaskSchedulerMinorVersion = 0;
  14. IID_IAction: TGUID = '{BAE54997-48B1-4CBE-9965-D6BE263EBEA4}';
  15. IID_IActionCollection: TGUID = '{02820E19-7B98-4ED2-B2E8-FDCCCEFF619B}';
  16. IID_IBootTrigger: TGUID = '{2A9C35DA-D357-41F4-BBC1-207AC1B1F3CB}';
  17. IID_IComHandlerAction: TGUID = '{6D2FD252-75C5-4F66-90BA-2A7D8CC3039F}';
  18. IID_IDailyTrigger: TGUID = '{126C5CD8-B288-41D5-8DBF-E491446ADC5C}';
  19. IID_IEmailAction: TGUID = '{10F62C64-7E16-4314-A0C2-0C3683F99D40}';
  20. IID_IEventTrigger: TGUID = '{D45B0167-9653-4EEF-B94F-0732CA7AF251}';
  21. IID_IExecAction: TGUID = '{4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047}';
  22. IID_IIdleSettings: TGUID = '{84594461-0053-4342-A8FD-088FABF11F32}';
  23. IID_IIdleTrigger: TGUID = '{D537D2B0-9FB3-4D34-9739-1FF5CE7B1EF3}';
  24. IID_ILogonTrigger: TGUID = '{72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C}';
  25. IID_IMonthlyDOWTrigger: TGUID = '{77D025A3-90FA-43AA-B52E-CDA5499B946A}';
  26. IID_IMonthlyTrigger: TGUID = '{97C45EF1-6B02-4A1A-9C0E-1EBFBA1500AC}';
  27. IID_INetworkSettings: TGUID = '{9F7DEA84-C30B-4245-80B6-00E9F646F1B4}';
  28. IID_IPrincipal: TGUID = '{D98D51E5-C9B4-496A-A9C1-18980261CF0F}';
  29. IID_IRegisteredTask: TGUID = '{9C86F320-DEE3-4DD1-B972-A303F26B061E}';
  30. IID_IRegisteredTaskCollection: TGUID = '{86627EB4-42A7-41E4-A4D9-AC33A72F2D52}';
  31. IID_IRegistrationInfo: TGUID = '{416D8B73-CB41-4EA1-805C-9BE9A5AC4A74}';
  32. IID_IRegistrationTrigger: TGUID = '{4C8FEC3A-C218-4E0C-B23D-629024DB91A2}';
  33. IID_IRepetitionPattern: TGUID = '{7FB9ACF1-26BE-400E-85B5-294B9C75DFD6}';
  34. IID_IRunningTask: TGUID = '{653758FB-7B9A-4F1E-A471-BEEB8E9B834E}';
  35. IID_IRunningTaskCollection: TGUID = '{6A67614B-6828-4FEC-AA54-6D52E8F1F2DB}';
  36. IID_ISessionStateChangeTrigger: TGUID = '{754DA71B-4385-4475-9DD9-598294FA3641}';
  37. IID_IShowMessageAction: TGUID = '{505E9E68-AF89-46B8-A30F-56162A83D537}';
  38. IID_ITaskDefinition: TGUID = '{F5BC8FC5-536D-4F77-B852-FBC1356FDEB6}';
  39. IID_ITaskFolder: TGUID = '{8CFAC062-A080-4C15-9A88-AA7C2AF80DFC}';
  40. IID_ITaskFolderCollection: TGUID = '{79184A66-8664-423F-97F1-637356A5D812}';
  41. IID_ITaskHandler: TGUID = '{839D7762-5121-4009-9234-4F0D19394F04}';
  42. IID_ITaskHandlerStatus: TGUID = '{EAEC7A8F-27A0-4DDC-8675-14726A01A38A}';
  43. IID_ITaskNamedValueCollection: TGUID = '{B4EF826B-63C3-46E4-A504-EF69E4F7EA4D}';
  44. IID_ITaskNamedValuePair: TGUID = '{39038068-2B46-4AFD-8662-7BB6F868D221}';
  45. IID_ITaskService: TGUID = '{2FABA4C7-4DA9-4013-9697-20CC3FD40F85}';
  46. IID_ITaskSettings: TGUID = '{8FD4711D-2D02-4C8C-87E3-EFF699DE127E}';
  47. IID_ITaskSettings2: TGUID = '{2C05C3F0-6EED-4C05-A15F-ED7D7A98A369}';
  48. IID_ITaskVariables: TGUID = '{3E4C9351-D966-4B8B-BB87-CEBA68BB0107}';
  49. IID_ITimeTrigger: TGUID = '{B45747E0-EBA7-4276-9F29-85C5BB300006}';
  50. IID_ITrigger: TGUID = '{09941815-EA89-4B5B-89E0-2A773801FAC3}';
  51. IID_ITriggerCollection: TGUID = '{85DF5081-1B24-4F32-878A-D9D14DF4CB77}';
  52. IID_IWeeklyTrigger: TGUID = '{5038FC98-82FF-436D-8728-A512A57C9DC1}';
  53. LIBID_TaskScheduler: TGUID = '{E34CB9F1-C7F7-424C-BE29-027DCC09363A}';
  54. CLSID_TaskHandlerStatusPS: TGUID = '{9F15266D-D7BA-48F0-93C1-E6895F6FE5AC}';
  55. CLSID_TaskHandlerPS: TGUID = '{F2A69DB7-DA2C-4352-9066-86FEE6DACAC9}';
  56. CLSID_TaskScheduler: TGUID = '{0F87369F-A4E5-4CFC-BD3E-73E6154572DD}';
  57. SCHED_S_TASK_READY = $00041300; // The task is ready to run at its next scheduled time.
  58. SCHED_S_TASK_RUNNING = $00041301; // The task is currently running.
  59. SCHED_S_TASK_DISABLED = $00041302; // The task will not run at the scheduled times because it has been disabled.
  60. SCHED_S_TASK_HAS_NOT_RUN = $00041303; // The task has not yet run.
  61. SCHED_S_TASK_NO_MORE_RUNS = $00041304; // There are no more runs scheduled for this task.
  62. SCHED_S_TASK_NOT_SCHEDULED = $00041305; // One or more of the properties that are needed to run this task on a schedule have not been set.
  63. SCHED_S_TASK_TERMINATED = $00041306; // The last run of the task was terminated by the user.
  64. SCHED_S_TASK_NO_VALID_TRIGGERS = $00041307; // Either the task has no triggers or the existing triggers are disabled or not set.
  65. SCHED_S_EVENT_TRIGGER = $00041308; // Event triggers do not have set run times.
  66. SCHED_E_TRIGGER_NOT_FOUND = $80041309; // A task's trigger is not found.
  67. SCHED_E_TASK_NOT_READY = $8004130A; // One or more of the properties required to run this task have not been set.
  68. SCHED_E_TASK_NOT_RUNNING = $8004130B; // There is no running instance of the task.
  69. SCHED_E_SERVICE_NOT_INSTALLED = $8004130C; // The Task Scheduler service is not installed on this computer.
  70. SCHED_E_CANNOT_OPEN_TASK = $8004130D; // The task object could not be opened.
  71. SCHED_E_INVALID_TASK = $8004130E; // The object is either an invalid task object or is not a task object.
  72. SCHED_E_ACCOUNT_INFORMATION_NOT_SET = $8004130F; // No account information could be found in the Task Scheduler security database for the task indicated.
  73. SCHED_E_ACCOUNT_NAME_NOT_FOUND = $80041310; // Unable to establish existence of the account specified.
  74. SCHED_E_ACCOUNT_DBASE_CORRUPT = $80041311; // Corruption was detected in the Task Scheduler security database; the database has been reset.
  75. SCHED_E_NO_SECURITY_SERVICES = $80041312; // Task Scheduler security services are available only on Windows NT.
  76. SCHED_E_UNKNOWN_OBJECT_VERSION = $80041313; // The task object version is either unsupported or invalid.
  77. SCHED_E_UNSUPPORTED_ACCOUNT_OPTION = $80041314; // The task has been configured with an unsupported combination of account settings and run time options.
  78. SCHED_E_SERVICE_NOT_RUNNING = $80041315; // The Task Scheduler Service is not running.
  79. SCHED_E_UNEXPECTEDNODE = $80041316; // The task XML contains an unexpected node.
  80. SCHED_E_NAMESPACE = $80041317; // The task XML contains an element or attribute from an unexpected namespace.
  81. SCHED_E_INVALIDVALUE = $80041318; // The task XML contains a value which is incorrectly formatted or out of range.
  82. SCHED_E_MISSINGNODE = $80041319; // The task XML is missing a required element or attribute.
  83. SCHED_E_MALFORMEDXML = $8004131A; // The task XML is malformed.
  84. SCHED_S_SOME_TRIGGERS_FAILED = $0004131B; // The task is registered, but not all specified triggers will start the task.
  85. SCHED_S_BATCH_LOGON_PROBLEM = $0004131C; // The task is registered, but may fail to start. Batch logon privilege needs to be enabled for the task principal.
  86. SCHED_E_TOO_MANY_NODES = $8004131D; // The task XML contains too many nodes of the same type.
  87. SCHED_E_PAST_END_BOUNDARY = $8004131E; // The task cannot be started after the trigger end boundary.
  88. SCHED_E_ALREADY_RUNNING = $8004131F; // An instance of this task is already running.
  89. SCHED_E_USER_NOT_LOGGED_ON = $80041320; // The task will not run because the user is not logged on.
  90. SCHED_E_INVALID_TASK_HASH = $80041321; // The task image is corrupt or has been tampered with.
  91. SCHED_E_SERVICE_NOT_AVAILABLE = $80041322; // The Task Scheduler service is not available.
  92. SCHED_E_SERVICE_TOO_BUSY = $80041323; // The Task Scheduler service is too busy to handle your request. Please try again later.
  93. SCHED_E_TASK_ATTEMPTED = $80041324; // The Task Scheduler service attempted to run the task, but the task did not run due to one of the constraints in the task definition.
  94. SCHED_S_TASK_QUEUED = $00041325; // The Task Scheduler service has asked the task to run.
  95. SCHED_E_TASK_DISABLED = $80041326; // The task is disabled.
  96. SCHED_E_TASK_NOT_V1_COMPAT = $80041327; // The task has properties that are not compatible with earlier versions of Windows.
  97. SCHED_E_START_ON_DEMAND = $80041328; // The task settings do not allow the task to start on demand.
  98. type
  99. TTaskRunFlags = (
  100. TASK_RUN_NO_FLAGS = $0,
  101. TASK_RUN_AS_SELF = $1,
  102. TASK_RUN_IGNORE_CONSTRAINTS = $2,
  103. TASK_RUN_USE_SESSION_ID = $4,
  104. TASK_RUN_USER_SID = $8
  105. );
  106. TASK_ENUM_FLAGS = (
  107. TASK_ENUM_HIDDEN = $1
  108. );
  109. TASK_LOGON_TYPE = (
  110. TASK_LOGON_NONE = 0,
  111. TASK_LOGON_PASSWORD = 1,
  112. TASK_LOGON_S4U = 2,
  113. TASK_LOGON_INTERACTIVE_TOKEN = 3,
  114. TASK_LOGON_GROUP = 4,
  115. TASK_LOGON_SERVICE_ACCOUNT = 5,
  116. TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD = 6
  117. );
  118. TASK_RUNLEVEL_TYPE = (
  119. TASK_RUNLEVEL_LUA = 0,
  120. TASK_RUNLEVEL_HIGHEST = 1
  121. );
  122. TASK_STATE = (
  123. TASK_STATE_UNKNOWN = 0,
  124. TASK_STATE_DISABLED = 1,
  125. TASK_STATE_QUEUED = 2,
  126. TASK_STATE_READY = 3,
  127. TASK_STATE_RUNNING = 4
  128. );
  129. TASK_CREATION = (
  130. TASK_VALIDATE_ONLY = $1,
  131. TASK_CREATE = $2,
  132. TASK_UPDATE = $4,
  133. TASK_CREATE_OR_UPDATE = $6,
  134. TASK_DISABLE = $8,
  135. TASK_DONT_ADD_PRINCIPAL_ACE = $10,
  136. TASK_IGNORE_REGISTRATION_TRIGGERS = $20
  137. );
  138. PTASK_TRIGGER_TYPE2 = ^TASK_TRIGGER_TYPE2;
  139. TASK_TRIGGER_TYPE2 = (
  140. TASK_TRIGGER_EVENT = 0,
  141. TASK_TRIGGER_TIME = 1,
  142. TASK_TRIGGER_DAILY = 2,
  143. TASK_TRIGGER_WEEKLY = 3,
  144. TASK_TRIGGER_MONTHLY = 4,
  145. TASK_TRIGGER_MONTHLYDOW = 5,
  146. TASK_TRIGGER_IDLE = 6,
  147. TASK_TRIGGER_REGISTRATION = 7,
  148. TASK_TRIGGER_BOOT = 8,
  149. TASK_TRIGGER_LOGON = 9,
  150. TASK_TRIGGER_SESSION_STATE_CHANGE = 11
  151. );
  152. TASK_SESSION_STATE_CHANGE_TYPE = (
  153. TASK_CONSOLE_CONNECT = 1,
  154. TASK_CONSOLE_DISCONNECT = 2,
  155. TASK_REMOTE_CONNECT = 3,
  156. TASK_REMOTE_DISCONNECT = 4,
  157. TASK_SESSION_LOCK = 7,
  158. TASK_SESSION_UNLOCK = 8
  159. );
  160. TASK_ACTION_TYPE = (
  161. TASK_ACTION_EXEC = 0,
  162. TASK_ACTION_COM_HANDLER = 5,
  163. TASK_ACTION_SEND_EMAIL = 6,
  164. TASK_ACTION_SHOW_MESSAGE = 7
  165. );
  166. TASK_INSTANCES_POLICY = (
  167. TASK_INSTANCES_PARALLEL = 0,
  168. TASK_INSTANCES_QUEUE = 1,
  169. TASK_INSTANCES_IGNORE_NEW = 2,
  170. TASK_INSTANCES_STOP_EXISTING = 3
  171. );
  172. TASK_COMPATIBILITY = (
  173. TASK_COMPATIBILITY_AT = 0,
  174. TASK_COMPATIBILITY_V1 = 1,
  175. TASK_COMPATIBILITY_V2 = 2
  176. );
  177. DAILY = packed record
  178. DaysInterval: Word;
  179. end;
  180. MONTHLYDATE = packed record
  181. rgfDays: DWORD;
  182. rgfMonths: WORD;
  183. end;
  184. MONTHLYDOW = packed record
  185. wWhichWeek: WORD;
  186. rgfDaysOfTheWeek: WORD;
  187. rgfMonths: WORD;
  188. end;
  189. WEEKLY = packed record
  190. WeeksInterval: WORD;
  191. rgfDaysOfTheWeek: WORD;
  192. end;
  193. TRIGGER_TYPE_UNION = record
  194. case Integer of
  195. 0:
  196. ( Daily: DAILY; );
  197. 1:
  198. ( Weekly: WEEKLY; );
  199. 2:
  200. ( MonthlyDate: MONTHLYDATE; );
  201. 3:
  202. ( MonthlyDOW: MONTHLYDOW; );
  203. end;
  204. type
  205. IActionCollection = interface;
  206. ITaskFolderCollection = interface;
  207. IRepetitionPattern = interface(IDispatch)
  208. ['{7FB9ACF1-26BE-400E-85B5-294B9C75DFD6}']
  209. function get_Interval: TBStr; safecall;
  210. procedure set_Interval(pInterval: TBStr); safecall;
  211. function get_Duration: TBStr; safecall;
  212. procedure set_Duration(pDuration: TBStr); safecall;
  213. function get_StopAtDurationEnd: WordBool; safecall;
  214. procedure set_StopAtDurationEnd(pStop: WordBool); safecall;
  215. property Interval: TBStr read get_Interval write set_Interval;
  216. property Duration: TBStr read get_Duration write set_Duration;
  217. property StopAtDurationEnd: WordBool read get_StopAtDurationEnd write set_StopAtDurationEnd;
  218. end;
  219. ITaskNamedValuePair = interface(IDispatch)
  220. ['{39038068-2B46-4AFD-8662-7BB6F868D221}']
  221. function get_Name: TBStr; safecall;
  222. procedure set_Name(pName: TBStr); safecall;
  223. function get_Value: TBStr; safecall;
  224. procedure set_Value(pValue: TBStr); safecall;
  225. property Name: TBStr read get_Name write set_Name;
  226. property Value: TBStr read get_Value write set_Value;
  227. end;
  228. ITaskNamedValueCollection = interface(IDispatch)
  229. ['{B4EF826B-63C3-46E4-A504-EF69E4F7EA4D}']
  230. function get_Count: Integer; safecall;
  231. function get_Item(index: Integer): ITaskNamedValuePair; safecall;
  232. function get__NewEnum: IUnknown; safecall;
  233. function Create(Name: TBStr; Value: TBStr; out ppPair: ITaskNamedValuePair): HRESULT; stdcall;
  234. function Remove(index: LONG): HRESULT; stdcall;
  235. function Clear: HRESULT; stdcall;
  236. property Count: Integer read get_Count;
  237. property Item[index: Integer]: ITaskNamedValuePair read get_Item; default;
  238. property _NewEnum: IUnknown read get__NewEnum;
  239. end;
  240. IRegistrationInfo = interface(IDispatch)
  241. ['{416D8B73-CB41-4EA1-805C-9BE9A5AC4A74}']
  242. function get_Description: TBStr; safecall;
  243. procedure set_Description(pDescription: TBStr); safecall;
  244. function get_Author: TBStr; safecall;
  245. procedure set_Author(pAuthor: TBStr); safecall;
  246. function get_Version: TBStr; safecall;
  247. procedure set_Version(pVersion: TBStr); safecall;
  248. function get_Date: TBStr; safecall;
  249. procedure set_Date(pDate: TBStr); safecall;
  250. function get_Documentation: TBStr; safecall;
  251. procedure set_Documentation(pDocumentation: TBStr); safecall;
  252. function get_XmlText: TBStr; safecall;
  253. procedure set_XmlText(pText: TBStr); safecall;
  254. function get_URI: TBStr; safecall;
  255. procedure set_URI(pUri: TBStr); safecall;
  256. function get_SecurityDescriptor: OleVariant; safecall;
  257. procedure set_SecurityDescriptor(pSddl: OleVariant); safecall;
  258. function get_Source: TBStr; safecall;
  259. procedure set_Source(pSource: TBStr); safecall;
  260. property Description: TBStr read get_Description write set_Description;
  261. property Author: TBStr read get_Author write set_Author;
  262. property Version: TBStr read get_Version write set_Version;
  263. property Date: TBStr read get_Date write set_Date;
  264. property Documentation: TBStr read get_Documentation write set_Documentation;
  265. property XmlText: TBStr read get_XmlText write set_XmlText;
  266. property URI: TBStr read get_URI write set_URI;
  267. property SecurityDescriptor: OleVariant read get_SecurityDescriptor write set_SecurityDescriptor;
  268. property Source: TBStr read get_Source write set_Source;
  269. end;
  270. ITrigger = interface(IDispatch)
  271. ['{09941815-EA89-4B5B-89E0-2A773801FAC3}']
  272. function get_type: TASK_TRIGGER_TYPE2; safecall;
  273. function get_Id: TBStr; safecall;
  274. procedure set_Id(pId: TBStr); safecall;
  275. function get_Repetition: IRepetitionPattern; safecall;
  276. procedure set_Repetition(ppRepeat: IRepetitionPattern); safecall;
  277. function get_ExecutionTimeLimit: TBStr; safecall;
  278. procedure set_ExecutionTimeLimit(pTimeLimit: TBStr); safecall;
  279. function get_StartBoundary: TBStr; safecall;
  280. procedure set_StartBoundary(pStart: TBStr); safecall;
  281. function get_EndBoundary: TBStr; safecall;
  282. procedure set_EndBoundary(pEnd: TBStr); safecall;
  283. function get_Enabled: WordBool; safecall;
  284. procedure set_Enabled(pEnabled: WordBool); safecall;
  285. property TriggerType: TASK_TRIGGER_TYPE2 read get_type;
  286. property Id: TBStr read get_Id write set_Id;
  287. property Repetition: IRepetitionPattern read get_Repetition write set_Repetition;
  288. property ExecutionTimeLimit: TBStr read get_ExecutionTimeLimit write set_ExecutionTimeLimit;
  289. property StartBoundary: TBStr read get_StartBoundary write set_StartBoundary;
  290. property EndBoundary: TBStr read get_EndBoundary write set_EndBoundary;
  291. property Enabled: WordBool read get_Enabled write set_Enabled;
  292. end;
  293. IBootTrigger = interface(ITrigger)
  294. ['{2A9C35DA-D357-41F4-BBC1-207AC1B1F3CB}']
  295. function get_Delay: TBStr; safecall;
  296. procedure set_Delay(pDelay: TBStr); safecall;
  297. property Delay: TBStr read get_Delay write set_Delay;
  298. end;
  299. IDailyTrigger = interface(ITrigger)
  300. ['{126C5CD8-B288-41D5-8DBF-E491446ADC5C}']
  301. function get_DaysInterval: Smallint; safecall;
  302. procedure set_DaysInterval(pDays: Smallint); safecall;
  303. function get_RandomDelay: TBStr; safecall;
  304. procedure set_RandomDelay(pRandomDelay: TBStr); safecall;
  305. property DaysInterval: Smallint read get_DaysInterval write set_DaysInterval;
  306. property RandomDelay: TBStr read get_RandomDelay write set_RandomDelay;
  307. end;
  308. IEventTrigger = interface(ITrigger)
  309. ['{D45B0167-9653-4EEF-B94F-0732CA7AF251}']
  310. function get_Subscription: TBStr; safecall;
  311. procedure set_Subscription(pQuery: TBStr); safecall;
  312. function get_Delay: TBStr; safecall;
  313. procedure set_Delay(pDelay: TBStr); safecall;
  314. function get_ValueQueries: ITaskNamedValueCollection; safecall;
  315. procedure set_ValueQueries(ppNamedXPaths: ITaskNamedValueCollection); safecall;
  316. property Subscription: TBStr read get_Subscription write set_Subscription;
  317. property Delay: TBStr read get_Delay write set_Delay;
  318. property ValueQueries: ITaskNamedValueCollection read get_ValueQueries write set_ValueQueries;
  319. end;
  320. IIdleTrigger = interface(ITrigger)
  321. ['{D537D2B0-9FB3-4D34-9739-1FF5CE7B1EF3}']
  322. end;
  323. ILogonTrigger = interface(ITrigger)
  324. ['{72DADE38-FAE4-4B3E-BAF4-5D009AF02B1C}']
  325. function get_Delay: TBStr; safecall;
  326. procedure set_Delay(pDelay: TBStr); safecall;
  327. function get_UserId: TBStr; safecall;
  328. procedure set_UserId(pUser: TBStr); safecall;
  329. property Delay: TBStr read get_Delay write set_Delay;
  330. property UserId: TBStr read get_UserId write set_UserId;
  331. end;
  332. IMonthlyTrigger = interface(ITrigger)
  333. ['{97C45EF1-6B02-4A1A-9C0E-1EBFBA1500AC}']
  334. function get_DaysOfMonth: Integer; safecall;
  335. procedure set_DaysOfMonth(pDays: Integer); safecall;
  336. function get_MonthsOfYear: Smallint; safecall;
  337. procedure set_MonthsOfYear(pMonths: Smallint); safecall;
  338. function get_RunOnLastDayOfMonth: WordBool; safecall;
  339. procedure set_RunOnLastDayOfMonth(pLastDay: WordBool); safecall;
  340. function get_RandomDelay: TBStr; safecall;
  341. procedure set_RandomDelay(pRandomDelay: TBStr); safecall;
  342. property DaysOfMonth: Integer read get_DaysOfMonth write set_DaysOfMonth;
  343. property MonthsOfYear: Smallint read get_MonthsOfYear write set_MonthsOfYear;
  344. property RunOnLastDayOfMonth: WordBool read get_RunOnLastDayOfMonth write set_RunOnLastDayOfMonth;
  345. property RandomDelay: TBStr read get_RandomDelay write set_RandomDelay;
  346. end;
  347. IMonthlyDOWTrigger = interface(ITrigger)
  348. ['{77D025A3-90FA-43AA-B52E-CDA5499B946A}']
  349. function get_DaysOfWeek: Smallint; safecall;
  350. procedure set_DaysOfWeek(pDays: Smallint); safecall;
  351. function get_WeeksOfMonth: Smallint; safecall;
  352. procedure set_WeeksOfMonth(pWeeks: Smallint); safecall;
  353. function get_MonthsOfYear: Smallint; safecall;
  354. procedure set_MonthsOfYear(pMonths: Smallint); safecall;
  355. function get_RunOnLastWeekOfMonth: WordBool; safecall;
  356. procedure set_RunOnLastWeekOfMonth(pLastWeek: WordBool); safecall;
  357. function get_RandomDelay: TBStr; safecall;
  358. procedure set_RandomDelay(pRandomDelay: TBStr); safecall;
  359. property DaysOfWeek: Smallint read get_DaysOfWeek write set_DaysOfWeek;
  360. property WeeksOfMonth: Smallint read get_WeeksOfMonth write set_WeeksOfMonth;
  361. property MonthsOfYear: Smallint read get_MonthsOfYear write set_MonthsOfYear;
  362. property RunOnLastWeekOfMonth: WordBool read get_RunOnLastWeekOfMonth write set_RunOnLastWeekOfMonth;
  363. property RandomDelay: TBStr read get_RandomDelay write set_RandomDelay;
  364. end;
  365. IRegistrationTrigger = interface(ITrigger)
  366. ['{4C8FEC3A-C218-4E0C-B23D-629024DB91A2}']
  367. function get_Delay: TBStr; safecall;
  368. procedure set_Delay(pDelay: TBStr); safecall;
  369. property Delay: TBStr read get_Delay write set_Delay;
  370. end;
  371. ISessionStateChangeTrigger = interface(ITrigger)
  372. ['{754DA71B-4385-4475-9DD9-598294FA3641}']
  373. function get_Delay: TBStr; safecall;
  374. procedure set_Delay(pDelay: TBStr); safecall;
  375. function get_UserId: TBStr; safecall;
  376. procedure set_UserId(pUser: TBStr); safecall;
  377. function get_StateChange: TASK_SESSION_STATE_CHANGE_TYPE; safecall;
  378. procedure set_StateChange(pType: TASK_SESSION_STATE_CHANGE_TYPE); safecall;
  379. property Delay: TBStr read get_Delay write set_Delay;
  380. property UserId: TBStr read get_UserId write set_UserId;
  381. property StateChange: TASK_SESSION_STATE_CHANGE_TYPE read get_StateChange write set_StateChange;
  382. end;
  383. ITimeTrigger = interface(ITrigger)
  384. ['{B45747E0-EBA7-4276-9F29-85C5BB300006}']
  385. function get_RandomDelay: TBStr; safecall;
  386. procedure set_RandomDelay(pRandomDelay: TBStr); safecall;
  387. property RandomDelay: TBStr read get_RandomDelay write set_RandomDelay;
  388. end;
  389. IWeeklyTrigger = interface(ITrigger)
  390. ['{5038FC98-82FF-436D-8728-A512A57C9DC1}']
  391. function get_DaysOfWeek: Smallint; safecall;
  392. procedure set_DaysOfWeek(pDays: Smallint); safecall;
  393. function get_WeeksInterval: Smallint; safecall;
  394. procedure set_WeeksInterval(pWeeks: Smallint); safecall;
  395. function get_RandomDelay: TBStr; safecall;
  396. procedure set_RandomDelay(pRandomDelay: TBStr); safecall;
  397. property DaysOfWeek: Smallint read get_DaysOfWeek write set_DaysOfWeek;
  398. property WeeksInterval: Smallint read get_WeeksInterval write set_WeeksInterval;
  399. property RandomDelay: TBStr read get_RandomDelay write set_RandomDelay;
  400. end;
  401. ITriggerCollection = interface(IDispatch)
  402. ['{85DF5081-1B24-4F32-878A-D9D14DF4CB77}']
  403. function get_Count: Integer; safecall;
  404. function get_Item(index: Integer): ITrigger; safecall;
  405. function get__NewEnum: IUnknown; safecall;
  406. function Create(triggerType: TASK_TRIGGER_TYPE2; out ppTrigger: ITrigger): HRESULT; stdcall;
  407. function Remove(index: OleVariant): HRESULT; stdcall;
  408. function Clear: HRESULT; stdcall;
  409. property Count: Integer read get_Count;
  410. property Item[index: Integer]: ITrigger read get_Item; default;
  411. property _NewEnum: IUnknown read get__NewEnum;
  412. end;
  413. IIdleSettings = interface(IDispatch)
  414. ['{84594461-0053-4342-A8FD-088FABF11F32}']
  415. function get_IdleDuration: TBStr; safecall;
  416. procedure set_IdleDuration(pDelay: TBStr); safecall;
  417. function get_WaitTimeout: TBStr; safecall;
  418. procedure set_WaitTimeout(pTimeout: TBStr); safecall;
  419. function get_StopOnIdleEnd: WordBool; safecall;
  420. procedure set_StopOnIdleEnd(pStop: WordBool); safecall;
  421. function get_RestartOnIdle: WordBool; safecall;
  422. procedure set_RestartOnIdle(pRestart: WordBool); safecall;
  423. property IdleDuration: TBStr read get_IdleDuration write set_IdleDuration;
  424. property WaitTimeout: TBStr read get_WaitTimeout write set_WaitTimeout;
  425. property StopOnIdleEnd: WordBool read get_StopOnIdleEnd write set_StopOnIdleEnd;
  426. property RestartOnIdle: WordBool read get_RestartOnIdle write set_RestartOnIdle;
  427. end;
  428. INetworkSettings = interface(IDispatch)
  429. ['{9F7DEA84-C30B-4245-80B6-00E9F646F1B4}']
  430. function get_Name: TBStr; safecall;
  431. procedure set_Name(pName: TBStr); safecall;
  432. function get_Id: TBStr; safecall;
  433. procedure set_Id(pId: TBStr); safecall;
  434. property Name: TBStr read get_Name write set_Name;
  435. property Id: TBStr read get_Id write set_Id;
  436. end;
  437. ITaskSettings = interface(IDispatch)
  438. ['{8FD4711D-2D02-4C8C-87E3-EFF699DE127E}']
  439. function get_AllowDemandStart: WordBool; safecall;
  440. procedure set_AllowDemandStart(pAllowDemandStart: WordBool); safecall;
  441. function get_RestartInterval: TBStr; safecall;
  442. procedure set_RestartInterval(pRestartInterval: TBStr); safecall;
  443. function get_RestartCount: SYSINT; safecall;
  444. procedure set_RestartCount(pRestartCount: SYSINT); safecall;
  445. function get_MultipleInstances: TASK_INSTANCES_POLICY; safecall;
  446. procedure set_MultipleInstances(pPolicy: TASK_INSTANCES_POLICY); safecall;
  447. function get_StopIfGoingOnBatteries: WordBool; safecall;
  448. procedure set_StopIfGoingOnBatteries(pStopIfOnBatteries: WordBool); safecall;
  449. function get_DisallowStartIfOnBatteries: WordBool; safecall;
  450. procedure set_DisallowStartIfOnBatteries(pDisallowStart: WordBool); safecall;
  451. function get_AllowHardTerminate: WordBool; safecall;
  452. procedure set_AllowHardTerminate(pAllowHardTerminate: WordBool); safecall;
  453. function get_StartWhenAvailable: WordBool; safecall;
  454. procedure set_StartWhenAvailable(pStartWhenAvailable: WordBool); safecall;
  455. function get_XmlText: TBStr; safecall;
  456. procedure set_XmlText(pText: TBStr); safecall;
  457. function get_RunOnlyIfNetworkAvailable: WordBool; safecall;
  458. procedure set_RunOnlyIfNetworkAvailable(pRunOnlyIfNetworkAvailable: WordBool); safecall;
  459. function get_ExecutionTimeLimit: TBStr; safecall;
  460. procedure set_ExecutionTimeLimit(pExecutionTimeLimit: TBStr); safecall;
  461. function get_Enabled: WordBool; safecall;
  462. procedure set_Enabled(pEnabled: WordBool); safecall;
  463. function get_DeleteExpiredTaskAfter: TBStr; safecall;
  464. procedure set_DeleteExpiredTaskAfter(pExpirationDelay: TBStr); safecall;
  465. function get_Priority: SYSINT; safecall;
  466. procedure set_Priority(pPriority: SYSINT); safecall;
  467. function get_Compatibility: TASK_COMPATIBILITY; safecall;
  468. procedure set_Compatibility(pCompatLevel: TASK_COMPATIBILITY); safecall;
  469. function get_Hidden: WordBool; safecall;
  470. procedure set_Hidden(pHidden: WordBool); safecall;
  471. function get_IdleSettings: IIdleSettings; safecall;
  472. procedure set_IdleSettings(ppIdleSettings: IIdleSettings); safecall;
  473. function get_RunOnlyIfIdle: WordBool; safecall;
  474. procedure set_RunOnlyIfIdle(pRunOnlyIfIdle: WordBool); safecall;
  475. function get_WakeToRun: WordBool; safecall;
  476. procedure set_WakeToRun(pWake: WordBool); safecall;
  477. function get_NetworkSettings: INetworkSettings; safecall;
  478. procedure set_NetworkSettings(ppNetworkSettings: INetworkSettings); safecall;
  479. property AllowDemandStart: WordBool read get_AllowDemandStart write set_AllowDemandStart;
  480. property RestartInterval: TBStr read get_RestartInterval write set_RestartInterval;
  481. property RestartCount: SYSINT read get_RestartCount write set_RestartCount;
  482. property MultipleInstances: TASK_INSTANCES_POLICY read get_MultipleInstances write set_MultipleInstances;
  483. property StopIfGoingOnBatteries: WordBool read get_StopIfGoingOnBatteries write set_StopIfGoingOnBatteries;
  484. property DisallowStartIfOnBatteries: WordBool read get_DisallowStartIfOnBatteries write set_DisallowStartIfOnBatteries;
  485. property AllowHardTerminate: WordBool read get_AllowHardTerminate write set_AllowHardTerminate;
  486. property StartWhenAvailable: WordBool read get_StartWhenAvailable write set_StartWhenAvailable;
  487. property XmlText: TBStr read get_XmlText write set_XmlText;
  488. property RunOnlyIfNetworkAvailable: WordBool read get_RunOnlyIfNetworkAvailable write set_RunOnlyIfNetworkAvailable;
  489. property ExecutionTimeLimit: TBStr read get_ExecutionTimeLimit write set_ExecutionTimeLimit;
  490. property Enabled: WordBool read get_Enabled write set_Enabled;
  491. property DeleteExpiredTaskAfter: TBStr read get_DeleteExpiredTaskAfter write set_DeleteExpiredTaskAfter;
  492. property Priority: SYSINT read get_Priority write set_Priority;
  493. property Compatibility: TASK_COMPATIBILITY read get_Compatibility write set_Compatibility;
  494. property Hidden: WordBool read get_Hidden write set_Hidden;
  495. property IdleSettings: IIdleSettings read get_IdleSettings write set_IdleSettings;
  496. property RunOnlyIfIdle: WordBool read get_RunOnlyIfIdle write set_RunOnlyIfIdle;
  497. property WakeToRun: WordBool read get_WakeToRun write set_WakeToRun;
  498. property NetworkSettings: INetworkSettings read get_NetworkSettings write set_NetworkSettings;
  499. end;
  500. ITaskSettings2 = interface(IDispatch)
  501. ['{2C05C3F0-6EED-4C05-A15F-ED7D7A98A369}']
  502. function get_DisallowStartOnRemoteAppSession: WordBool; safecall;
  503. procedure set_DisallowStartOnRemoteAppSession(pDisallowStart: WordBool); safecall;
  504. function get_UseUnifiedSchedulingEngine: WordBool; safecall;
  505. procedure set_UseUnifiedSchedulingEngine(pUseUnifiedEngine: WordBool); safecall;
  506. property DisallowStartOnRemoteAppSession: WordBool read get_DisallowStartOnRemoteAppSession write set_DisallowStartOnRemoteAppSession;
  507. property UseUnifiedSchedulingEngine: WordBool read get_UseUnifiedSchedulingEngine write set_UseUnifiedSchedulingEngine;
  508. end;
  509. IPrincipal = interface(IDispatch)
  510. ['{D98D51E5-C9B4-496A-A9C1-18980261CF0F}']
  511. function get_Id: TBStr; safecall;
  512. procedure set_Id(pId: TBStr); safecall;
  513. function get_DisplayName: TBStr; safecall;
  514. procedure set_DisplayName(pName: TBStr); safecall;
  515. function get_UserId: TBStr; safecall;
  516. procedure set_UserId(pUser: TBStr); safecall;
  517. function get_LogonType: TASK_LOGON_TYPE; safecall;
  518. procedure set_LogonType(pLogon: TASK_LOGON_TYPE); safecall;
  519. function get_GroupId: TBStr; safecall;
  520. procedure set_GroupId(pGroup: TBStr); safecall;
  521. function get_RunLevel: TASK_RUNLEVEL_TYPE; safecall;
  522. procedure set_RunLevel(pRunLevel: TASK_RUNLEVEL_TYPE); safecall;
  523. property Id: TBStr read get_Id write set_Id;
  524. property DisplayName: TBStr read get_DisplayName write set_DisplayName;
  525. property UserId: TBStr read get_UserId write set_UserId;
  526. property LogonType: TASK_LOGON_TYPE read get_LogonType write set_LogonType;
  527. property GroupId: TBStr read get_GroupId write set_GroupId;
  528. property RunLevel: TASK_RUNLEVEL_TYPE read get_RunLevel write set_RunLevel;
  529. end;
  530. IAction = interface(IDispatch)
  531. ['{BAE54997-48B1-4CBE-9965-D6BE263EBEA4}']
  532. function get_Id: TBStr; safecall;
  533. procedure set_Id(pId: TBStr); safecall;
  534. function get_type: TASK_ACTION_TYPE; safecall;
  535. property Id: TBStr read get_Id write set_Id;
  536. property ActionType: TASK_ACTION_TYPE read get_type;
  537. end;
  538. IComHandlerAction = interface(IAction)
  539. ['{6D2FD252-75C5-4F66-90BA-2A7D8CC3039F}']
  540. function get_ClassId: TBStr; safecall;
  541. procedure set_ClassId(pClsid: TBStr); safecall;
  542. function get_Data: TBStr; safecall;
  543. procedure set_Data(pData: TBStr); safecall;
  544. property ClassId: TBStr read get_ClassId write set_ClassId;
  545. property Data: TBStr read get_Data write set_Data;
  546. end;
  547. IEmailAction = interface(IAction)
  548. ['{10F62C64-7E16-4314-A0C2-0C3683F99D40}']
  549. function get_Server: TBStr; safecall;
  550. procedure set_Server(pServer: TBStr); safecall;
  551. function get_Subject: TBStr; safecall;
  552. procedure set_Subject(pSubject: TBStr); safecall;
  553. function get_To_: TBStr; safecall;
  554. procedure set_To_(pTo: TBStr); safecall;
  555. function get_Cc: TBStr; safecall;
  556. procedure set_Cc(pCc: TBStr); safecall;
  557. function get_Bcc: TBStr; safecall;
  558. procedure set_Bcc(pBcc: TBStr); safecall;
  559. function get_ReplyTo: TBStr; safecall;
  560. procedure set_ReplyTo(pReplyTo: TBStr); safecall;
  561. function get_From: TBStr; safecall;
  562. procedure set_From(pFrom: TBStr); safecall;
  563. function get_HeaderFields: ITaskNamedValueCollection; safecall;
  564. procedure set_HeaderFields(ppHeaderFields: ITaskNamedValueCollection); safecall;
  565. function get_Body: TBStr; safecall;
  566. procedure set_Body(pBody: TBStr); safecall;
  567. function get_Attachments: PSafeArray; safecall;
  568. procedure set_Attachments(pAttachements: PSafeArray); safecall;
  569. property Server: TBStr read get_Server write set_Server;
  570. property Subject: TBStr read get_Subject write set_Subject;
  571. property To_: TBStr read get_To_ write set_To_;
  572. property Cc: TBStr read get_Cc write set_Cc;
  573. property Bcc: TBStr read get_Bcc write set_Bcc;
  574. property ReplyTo: TBStr read get_ReplyTo write set_ReplyTo;
  575. property From: TBStr read get_From write set_From;
  576. property HeaderFields: ITaskNamedValueCollection read get_HeaderFields write set_HeaderFields;
  577. property Body: TBStr read get_Body write set_Body;
  578. property Attachments: PSafeArray read get_Attachments write set_Attachments;
  579. end;
  580. IExecAction = interface(IAction)
  581. ['{4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047}']
  582. function get_Path: TBStr; safecall;
  583. procedure set_Path(pPath: TBStr); safecall;
  584. function get_Arguments: TBStr; safecall;
  585. procedure set_Arguments(pArgument: TBStr); safecall;
  586. function get_WorkingDirectory: TBStr; safecall;
  587. procedure set_WorkingDirectory(pWorkingDirectory: TBStr); safecall;
  588. property Path: TBStr read get_Path write set_Path;
  589. property Arguments: TBStr read get_Arguments write set_Arguments;
  590. property WorkingDirectory: TBStr read get_WorkingDirectory write set_WorkingDirectory;
  591. end;
  592. IShowMessageAction = interface(IAction)
  593. ['{505E9E68-AF89-46B8-A30F-56162A83D537}']
  594. function get_Title: TBStr; safecall;
  595. procedure set_Title(pTitle: TBStr); safecall;
  596. function get_MessageBody: TBStr; safecall;
  597. procedure set_MessageBody(pMessageBody: TBStr); safecall;
  598. property Title: TBStr read get_Title write set_Title;
  599. property MessageBody: TBStr read get_MessageBody write set_MessageBody;
  600. end;
  601. IActionCollection = interface(IDispatch)
  602. ['{02820E19-7B98-4ED2-B2E8-FDCCCEFF619B}']
  603. function get_Count: Integer; safecall;
  604. function get_Item(index: Integer): IAction; safecall;
  605. function get__NewEnum: IUnknown; safecall;
  606. function get_XmlText: TBStr; safecall;
  607. procedure set_XmlText(pText: TBStr); safecall;
  608. function Create(ActionType: TASK_ACTION_TYPE; out ppAction: IAction): HRESULT; stdcall;
  609. function Remove(index: OleVariant): HRESULT; stdcall;
  610. function Clear: HRESULT; stdcall;
  611. function get_Context: TBStr; safecall;
  612. procedure set_Context(pContext: TBStr); safecall;
  613. property Count: Integer read get_Count;
  614. property Item[index: Integer]: IAction read get_Item; default;
  615. property _NewEnum: IUnknown read get__NewEnum;
  616. property XmlText: TBStr read get_XmlText write set_XmlText;
  617. property Context: TBStr read get_Context write set_Context;
  618. end;
  619. ITaskVariables = interface(IUnknown)
  620. ['{3E4C9351-D966-4B8B-BB87-CEBA68BB0107}']
  621. function GetInput(out pInput: TBStr): HRESULT; stdcall;
  622. function SetOutput(input: TBStr): HRESULT; stdcall;
  623. function GetContext(out pContext: TBStr): HRESULT; stdcall;
  624. end;
  625. ITaskDefinition = interface(IDispatch)
  626. ['{F5BC8FC5-536D-4F77-B852-FBC1356FDEB6}']
  627. function get_RegistrationInfo: IRegistrationInfo; safecall;
  628. procedure set_RegistrationInfo(ppRegistrationInfo: IRegistrationInfo); safecall;
  629. function get_Triggers: ITriggerCollection; safecall;
  630. procedure set_Triggers(ppTriggers: ITriggerCollection); safecall;
  631. function get_Settings: ITaskSettings; safecall;
  632. procedure set_Settings(ppSettings: ITaskSettings); safecall;
  633. function get_Data: TBStr; safecall;
  634. procedure set_Data(pData: TBStr); stdcall;
  635. function get_Principal: IPrincipal; safecall;
  636. procedure set_Principal(ppPrincipal: IPrincipal); safecall;
  637. function get_Actions: IActionCollection; safecall;
  638. procedure set_Actions(ppActions: IActionCollection); safecall;
  639. function get_XmlText: TBStr; safecall;
  640. procedure set_XmlText(pXml: TBStr); safecall;
  641. property RegistrationInfo: IRegistrationInfo read get_RegistrationInfo write set_RegistrationInfo;
  642. property Triggers: ITriggerCollection read get_Triggers write set_Triggers;
  643. property Settings: ITaskSettings read get_Settings write set_Settings;
  644. property Data: TBStr read get_Data write set_Data;
  645. property Principal: IPrincipal read get_Principal write set_Principal;
  646. property Actions: IActionCollection read get_Actions write set_Actions;
  647. property XmlText: TBStr read get_XmlText write set_XmlText;
  648. end;
  649. IRunningTask = interface(IDispatch)
  650. ['{653758FB-7B9A-4F1E-A471-BEEB8E9B834E}']
  651. function get_Name: TBStr; safecall;
  652. function get_InstanceGuid: TBStr; safecall;
  653. function get_Path: TBStr; safecall;
  654. function get_State: TASK_STATE; safecall;
  655. function get_CurrentAction: TBStr; safecall;
  656. function Stop: HRESULT; stdcall;
  657. function Refresh: HRESULT; stdcall;
  658. function get_EnginePID: LongWord; safecall;
  659. property Name: TBStr read get_Name;
  660. property InstanceGuid: TBStr read get_InstanceGuid;
  661. property Path: TBStr read get_Path;
  662. property State: TASK_STATE read get_State;
  663. property CurrentAction: TBStr read get_CurrentAction;
  664. property EnginePID: LongWord read get_EnginePID;
  665. end;
  666. IRunningTaskCollection = interface(IDispatch)
  667. ['{6A67614B-6828-4FEC-AA54-6D52E8F1F2DB}']
  668. function get_Count: Integer; safecall;
  669. function get_Item(index: OleVariant): IRunningTask; safecall;
  670. function get__NewEnum: IUnknown; safecall;
  671. property Count: Integer read get_Count;
  672. property Item[index: OleVariant]: IRunningTask read get_Item; default;
  673. property _NewEnum: IUnknown read get__NewEnum;
  674. end;
  675. IRegisteredTask = interface(IDispatch)
  676. ['{9C86F320-DEE3-4DD1-B972-A303F26B061E}']
  677. function get_Name: TBStr; safecall;
  678. function get_Path: TBStr; safecall;
  679. function get_State: TASK_STATE; safecall;
  680. function get_Enabled: WordBool; safecall;
  681. procedure set_Enabled(pEnabled: WordBool); safecall;
  682. function Run(params: OleVariant;
  683. out ppRunningTask: IRunningTask): HRESULT; stdcall;
  684. function RunEx(params: OleVariant; flags: LONG; sessionID: Integer;
  685. user: TBStr; out ppRunningTask: IRunningTask): HRESULT; stdcall;
  686. function GetInstances(flags: LONG;
  687. out ppRunningTasks: IRunningTaskCollection): HRESULT; stdcall;
  688. function get_LastRunTime: TDateTime; safecall;
  689. function get_LastTaskResult: Integer; safecall;
  690. function get_NumberOfMissedRuns: Integer; safecall;
  691. function get_NextRunTime: TDateTime; safecall;
  692. function get_Definition: ITaskDefinition; safecall;
  693. function get_Xml: TBStr; safecall;
  694. function GetSecurityDescriptor(securityInformation: Integer; out pSddl: TBStr): HRESULT; stdcall;
  695. function SetSecurityDescriptor(sddl: TBStr; flags: LONG): HRESULT; stdcall;
  696. function Stop(flags: LONG): HRESULT; stdcall;
  697. function GetRunTimes(pstStart, pstEnd: PSystemTime; var pCount: DWORD;
  698. out pRunTimes: PSystemTime): HRESULT; stdcall;
  699. property Name: TBStr read get_Name;
  700. property Path: TBStr read get_Path;
  701. property State: TASK_STATE read get_State;
  702. property Enabled: WordBool read get_Enabled write set_Enabled;
  703. property LastRunTime: TDateTime read get_LastRunTime;
  704. property LastTaskResult: Integer read get_LastTaskResult;
  705. property NumberOfMissedRuns: Integer read get_NumberOfMissedRuns;
  706. property NextRunTime: TDateTime read get_NextRunTime;
  707. property Definition: ITaskDefinition read get_Definition;
  708. property XML: TBStr read get_Xml;
  709. end;
  710. IRegisteredTaskCollection = interface(IDispatch)
  711. ['{86627EB4-42A7-41E4-A4D9-AC33A72F2D52}']
  712. function get_Count: Integer; safecall;
  713. function get_Item(index: OleVariant): IRegisteredTask; safecall;
  714. function get__NewEnum: IUnknown; safecall;
  715. property Count: Integer read get_Count;
  716. property Item[index: OleVariant]: IRegisteredTask read get_Item; default;
  717. property _NewEnum: IUnknown read get__NewEnum;
  718. end;
  719. ITaskHandler = interface(IUnknown)
  720. ['{839D7762-5121-4009-9234-4F0D19394F04}']
  721. function Start(pHandlerServices: IUnknown; data: TBStr): HRESULT; stdcall;
  722. function Stop(out pRetCode: HRESULT): HRESULT; stdcall;
  723. function Pause: HRESULT; stdcall;
  724. function Resume: HRESULT; stdcall;
  725. end;
  726. ITaskHandlerStatus = interface(IUnknown)
  727. ['{EAEC7A8F-27A0-4DDC-8675-14726A01A38A}']
  728. function UpdateStatus(percentComplete: SHORT; statusMessage: TBStr): HRESULT; stdcall;
  729. function TaskCompleted(taskErrCode: HRESULT): HRESULT; stdcall;
  730. end;
  731. ITaskFolder = interface(IDispatch)
  732. ['{8CFAC062-A080-4C15-9A88-AA7C2AF80DFC}']
  733. function get_Name: TBStr; safecall;
  734. function get_Path: TBStr; safecall;
  735. function GetFolder(Path: TBStr; out ppFolder: ITaskFolder): HRESULT; stdcall;
  736. function GetFolders(flags: LONG; out ppFolders: ITaskFolderCollection): HRESULT; stdcall;
  737. function CreateFolder(subFolderName: TBStr; sddl: OleVariant; out ppFolder: ITaskFolder): HRESULT; stdcall;
  738. function DeleteFolder(subFolderName: TBStr; flags: LONG): HRESULT; stdcall;
  739. function GetTask(path: TBStr; out ppTask: IRegisteredTask): HRESULT; stdcall;
  740. function GetTasks(flags: LONG; out ppTasks: IRegisteredTaskCollection): HRESULT; stdcall;
  741. function DeleteTask(Name: TBStr; flags: LONG): HRESULT; stdcall;
  742. function RegisterTask(Path: TBStr; XmlText: TBStr; flags: LONG; UserId: OleVariant;
  743. password: OleVariant; LogonType: TASK_LOGON_TYPE; sddl: OleVariant; out ppTask: IRegisteredTask): HRESULT; stdcall;
  744. function RegisterTaskDefinition(path: TBStr; pDefinition: ITaskDefinition; flags: LONG;
  745. TASK_CREATION: OleVariant; password: OleVariant; logonType: TASK_LOGON_TYPE;
  746. sddl: OleVariant; out ppTask: IRegisteredTask): HRESULT; stdcall;
  747. function GetSecurityDescriptor(securityInformation: Integer; out pSddl: TBStr): HRESULT; stdcall;
  748. function SetSecurityDescriptor(sddl: TBStr; flags: LONG): HRESULT; stdcall;
  749. property Name: TBStr read get_Name;
  750. property Path: TBStr read get_Path;
  751. end;
  752. ITaskFolderCollection = interface(IDispatch)
  753. ['{79184A66-8664-423F-97F1-637356A5D812}']
  754. function get_Count: Integer; safecall;
  755. function get_Item(index: OleVariant): ITaskFolder; safecall;
  756. function get__NewEnum: IUnknown; safecall;
  757. property Count: Integer read get_Count;
  758. property Item[index: OleVariant]: ITaskFolder read get_Item; default;
  759. property _NewEnum: IUnknown read get__NewEnum;
  760. end;
  761. ITaskService = interface(IDispatch)
  762. ['{2FABA4C7-4DA9-4013-9697-20CC3FD40F85}']
  763. function GetFolder(Path: TBStr; out ppFolder: ITaskFolder): HRESULT; stdcall;
  764. function GetRunningTasks(flags: LONG; out ppRunningTasks: IRunningTaskCollection): HRESULT; stdcall;
  765. function NewTask(flags: DWORD; out ppDefinition: ITaskDefinition): HRESULT; stdcall;
  766. function Connect(serverName: OleVariant; user: OleVariant;
  767. domain: OleVariant; password: OleVariant): HRESULT; stdcall;
  768. function get_Connected: WordBool; safecall;
  769. function get_TargetServer: TBStr; safecall;
  770. function get_ConnectedUser: TBStr; safecall;
  771. function get_ConnectedDomain: TBStr; safecall;
  772. function get_HighestVersion: LongWord; safecall;
  773. property Connected: WordBool read get_Connected;
  774. property TargetServer: TBStr read get_TargetServer;
  775. property ConnectedUser: TBStr read get_ConnectedUser;
  776. property ConnectedDomain: TBStr read get_ConnectedDomain;
  777. property HighestVersion: LongWord read get_HighestVersion;
  778. end;
  779. implementation
  780. end.