-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
WinTaskScheduler.pas
1539 lines (1378 loc) · 68.6 KB
/
WinTaskScheduler.pas
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-------------------------------------------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-------------------------------------------------------------------------------}
{===============================================================================
WinTaskScheduler
This unit provides types, constants and most importantly interfaces for
Windows Task Scheduler. Interfaces for both Task Scheduler 1.0 and
Task Scheduler 2.0 are included.
TS 1.0 should be used only on Windows 2000, XP and Server 2003, it is
deprecated since Windows Vista and should not be used there (although
it seems to work for now).
TS 2.0 is available only from Windows Vista up.
version 1.0 (2017-08-25)
Last change 2020-08-02
©2017-2020 František Milt
Contacts:
František Milt: [email protected]
Support:
If you find this code useful, please consider supporting its author(s) by
making a small donation using the following link(s):
https://www.paypal.me/FMilt
Changelog:
For detailed changelog and history please refer to this git repository:
github.com/TheLazyTomcat/Bnd.WinTaskScheduler
Dependencies:
none
===============================================================================}
unit WinTaskScheduler;
{$IF not(defined(MSWINDOWS) or defined(WINDOWS))}
{$MESSAGE FATAL 'Unsupported operating system.'}
{$IFEND}
{$IFDEF FPC}
{$MODE ObjFPC}
{$ENDIF}
{$H+}
{$MINENUMSIZE 4}
interface
uses
Windows, ActiveX;
{===============================================================================
Basic types
===============================================================================}
type
INT = Integer;
LONG = LongInt;
VARIANT_BOOL = WordBool;
PLPWSTR = ^LPWSTR;
PPLPWSTR = ^PLPWSTR;
BSTR = PWideChar;
PBSTR = ^BSTR;
DATE = TDateTime;
HPROPSHEETPAGE = THandle;
PHPROPSHEETPAGE = ^HPROPSHEETPAGE;
LPSYSTEMTIME = ^SYSTEMTIME;
PLPSYSTEMTIME = ^LPSYSTEMTIME;
PHRESULT = ^HRESULT;
PPBYTE = ^PBYTE;
REFIID = ^TGUID;
REFCLSID = ^TGUID;
PIUnknown = ^IUnknown;
{===============================================================================
--------------------------------------------------------------------------------
Task Scheduler 1.0 (MSTask.h, MSTask.idl)
--------------------------------------------------------------------------------
===============================================================================}
{===============================================================================
Datatypes
===============================================================================}
const
TASK_SUNDAY = $1;
TASK_MONDAY = $2;
TASK_TUESDAY = $4;
TASK_WEDNESDAY = $8;
TASK_THURSDAY = $10;
TASK_FRIDAY = $20;
TASK_SATURDAY = $40;
TASK_FIRST_WEEK = 1;
TASK_SECOND_WEEK = 2;
TASK_THIRD_WEEK = 3;
TASK_FOURTH_WEEK = 4;
TASK_LAST_WEEK = 5;
TASK_JANUARY = $1;
TASK_FEBRUARY = $2;
TASK_MARCH = $4;
TASK_APRIL = $8;
TASK_MAY = $10;
TASK_JUNE = $20;
TASK_JULY = $40;
TASK_AUGUST = $80;
TASK_SEPTEMBER = $100;
TASK_OCTOBER = $200;
TASK_NOVEMBER = $400;
TASK_DECEMBER = $800;
TASK_FLAG_INTERACTIVE = $1;
TASK_FLAG_DELETE_WHEN_DONE = $2;
TASK_FLAG_DISABLED = $4;
TASK_FLAG_START_ONLY_IF_IDLE = $10;
TASK_FLAG_KILL_ON_IDLE_END = $20;
TASK_FLAG_DONT_START_IF_ON_BATTERIES = $40;
TASK_FLAG_KILL_IF_GOING_ON_BATTERIES = $80;
TASK_FLAG_RUN_ONLY_IF_DOCKED = $100;
TASK_FLAG_HIDDEN = $200;
TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET = $400;
TASK_FLAG_RESTART_ON_IDLE_RESUME = $800;
TASK_FLAG_SYSTEM_REQUIRED = $1000;
TASK_FLAG_RUN_ONLY_IF_LOGGED_ON = $2000;
TASK_TRIGGER_FLAG_HAS_END_DATE = $1;
TASK_TRIGGER_FLAG_KILL_AT_DURATION_END = $2;
TASK_TRIGGER_FLAG_DISABLED = $4;
{
1440 = 60 mins/hour * 24 hrs/day since a trigger/TASK could run all day at
one minute intervals.
}
TASK_MAX_RUN_TIMES = 1440;
//==============================================================================
type
{
The TASK_TRIGGER_TYPE field of the TASK_TRIGGER structure determines
which member of the TRIGGER_TYPE_UNION field to use.
https://msdn.microsoft.com/library/windows/desktop/aa383620
}
_TASK_TRIGGER_TYPE =(
TASK_TIME_TRIGGER_ONCE, // Ignore the Type field.
TASK_TIME_TRIGGER_DAILY, // Use DAILY
TASK_TIME_TRIGGER_WEEKLY, // Use WEEKLY
TASK_TIME_TRIGGER_MONTHLYDATE, // Use MONTHLYDATE
TASK_TIME_TRIGGER_MONTHLYDOW, // Use MONTHLYDOW
TASK_EVENT_TRIGGER_ON_IDLE, // Ignore the Type field.
TASK_EVENT_TRIGGER_AT_SYSTEMSTART, // Ignore the Type field.
TASK_EVENT_TRIGGER_AT_LOGON); // Ignore the Type field.
TASK_TRIGGER_TYPE = _TASK_TRIGGER_TYPE;
PTASK_TRIGGER_TYPE = ^TASK_TRIGGER_TYPE;
{
https://msdn.microsoft.com/library/windows/desktop/aa446857
}
_DAILY = record
DaysInterval: WORD;
end;
DAILY = _DAILY;
{
https://msdn.microsoft.com/library/windows/desktop/aa384014
}
_WEEKLY = record
WeeksInterval: WORD;
rgfDaysOfTheWeek: WORD;
end;
WEEKLY = _WEEKLY;
{
https://msdn.microsoft.com/library/windows/desktop/aa381918
}
_MONTHLYDATE = record
rgfDays: DWORD;
rgfMonths: WORD;
end;
MONTHLYDATE = _MONTHLYDATE;
{
https://msdn.microsoft.com/library/windows/desktop/aa381950
}
_MONTHLYDOW = record
wWhichWeek: WORD;
rgfDaysOfTheWeek: WORD;
rgfMonths: WORD;
end;
MONTHLYDOW = _MONTHLYDOW;
{
https://msdn.microsoft.com/library/windows/desktop/aa384002
}
_TRIGGER_TYPE_UNION = record
case Integer of
0: (Daily: DAILY);
1: (Weekly: WEEKLY);
2: (MonthlyDate: MONTHLYDATE);
3: (MonthlyDOW: MONTHLYDOW);
end;
TRIGGER_TYPE_UNION = _TRIGGER_TYPE_UNION;
{
https://msdn.microsoft.com/library/windows/desktop/aa383618
}
_TASK_TRIGGER = record
cbTriggerSize: WORD; // Structure size.
Reserved1: WORD; // Reserved. Must be zero.
wBeginYear: WORD; // Trigger beginning date year.
wBeginMonth: WORD; // Trigger beginning date month.
wBeginDay: WORD; // Trigger beginning date day.
wEndYear: WORD; // Optional trigger ending date year.
wEndMonth: WORD; // Optional trigger ending date month.
wEndDay: WORD; // Optional trigger ending date day.
wStartHour: WORD; // Run bracket start time hour.
wStartMinute: WORD; // Run bracket start time minute.
MinutesDuration: DWORD; // Duration of run bracket.
MinutesInterval: DWORD; // Run bracket repetition interval.
rgFlags: DWORD; // Trigger flags.
TriggerType: TASK_TRIGGER_TYPE; // Trigger type.
// "Type" is reserved word in pascal...
Type_: TRIGGER_TYPE_UNION; // Trigger data.
Reserved2: WORD; // Reserved. Must be zero.
wRandomMinutesInterval: WORD; // Maximum number of random minutes after start time.
end;
TASK_TRIGGER = _TASK_TRIGGER;
PTASK_TRIGGER = ^TASK_TRIGGER;
{===============================================================================
Interfaces
===============================================================================}
const
IID_ITaskTrigger: TGUID = '{148BD52B-A2AB-11CE-B11F-00AA00530503}';
IID_IScheduledWorkItem: TGUID = '{a6b952f0-a4b1-11d0-997d-00aa006887ec}';
IID_ITask: TGUID = '{148BD524-A2AB-11CE-B11F-00AA00530503}';
IID_IEnumWorkItems: TGUID = '{148BD528-A2AB-11CE-B11F-00AA00530503}';
IID_ITaskScheduler: TGUID = '{148BD527-A2AB-11CE-B11F-00AA00530503}';
IID_IProvideTaskPage: TGUID = '{4086658a-cbbb-11cf-b604-00c04fd8d565}';
{-------------------------------------------------------------------------------
Interface: ITaskTrigger
Synopsis: Trigger object interface. A Task object may contain several
of these.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa381864
}
type
PITaskTrigger = ^ITaskTrigger;
ITaskTrigger = interface(IUnknown)
['{148BD52B-A2AB-11CE-B11F-00AA00530503}']
Function SetTrigger(const pTrigger: PTASK_TRIGGER): HRESULT; stdcall;
Function GetTrigger(pTrigger: PTASK_TRIGGER): HRESULT; stdcall;
Function GetTriggerString(ppwszTrigger: PLPWSTR): HRESULT; stdcall;
end;
{-------------------------------------------------------------------------------
Interface: IScheduledWorkItem
Synopsis: Abstract base class for any runnable work item that can be
scheduled by the task scheduler.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa381216
}
IScheduledWorkItem = interface(IUnknown)
['{a6b952f0-a4b1-11d0-997d-00aa006887ec}']
Function CreateTrigger(piNewTrigger: PWORD; ppTrigger: PITaskTrigger): HRESULT; stdcall;
Function DeleteTrigger(iTrigger: WORD): HRESULT; stdcall;
Function GetTriggerCount(plCount: PWORD): HRESULT; stdcall;
Function GetTrigger(iTrigger: WORD; ppTrigger: PITaskTrigger): HRESULT; stdcall;
Function GetTriggerString(iTrigger: WORD; ppwszTrigger: PLPWSTR): HRESULT; stdcall;
Function GetRunTimes(pstBegin: LPSYSTEMTIME; pstEnd: LPSYSTEMTIME; pCount: PWORD; rgstTaskTimes: PLPSYSTEMTIME): HRESULT; stdcall;
Function GetNextRunTime(pstNextRun: PSYSTEMTIME): HRESULT; stdcall;
Function SetIdleWait(wIdleMinutes: WORD; wDeadlineMinutes: WORD): HRESULT; stdcall;
Function GetIdleWait(pwIdleMinutes: PWORD; pwDeadlineMinutes: PWORD): HRESULT; stdcall;
Function Run: HRESULT; stdcall;
Function Terminate: HRESULT; stdcall;
Function EditWorkItem(hParent: HWND; dwReserved: DWORD): HRESULT; stdcall;
Function GetMostRecentRunTime(pstLastRun: PSYSTEMTIME): HRESULT; stdcall;
Function GetStatus(phrStatus: PHRESULT): HRESULT; stdcall;
Function GetExitCode(pdwExitCode: PDWORD): HRESULT; stdcall;
Function SetComment(pwszComment: LPCWSTR): HRESULT; stdcall;
Function GetComment(ppwszComment: PLPWSTR): HRESULT; stdcall;
Function SetCreator(pwszCreator: LPCWSTR): HRESULT; stdcall;
Function GetCreator(ppwszCreator: PLPWSTR): HRESULT; stdcall;
// rgbData is actually pointer to array of bytes
Function SetWorkItemData(cBytes: WORD; rgbData: PBYTE): HRESULT; stdcall;
Function GetWorkItemData(pcBytes: PWORD; ppBytes: PPBYTE): HRESULT; stdcall;
Function SetErrorRetryCount(wRetryCount: WORD): HRESULT; stdcall;
Function GetErrorRetryCount(pwRetryCount: PWORD): HRESULT; stdcall;
Function SetErrorRetryInterval(wRetryInterval: WORD): HRESULT; stdcall;
Function GetErrorRetryInterval(pwRetryInterval: PWORD): HRESULT; stdcall;
Function SetFlags(dwFlags: DWORD): HRESULT; stdcall;
Function GetFlags(pdwFlags: PDWORD): HRESULT; stdcall;
Function SetAccountInformation(pwszAccountName: LPCWSTR;pwszPassword: LPCWSTR): HRESULT; stdcall;
Function GetAccountInformation(ppwszAccountName: PLPWSTR): HRESULT; stdcall;
end;
{-------------------------------------------------------------------------------
Interface: ITask
Synopsis: Task object interface. The primary means of task object
manipulation.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa381311
}
ITask = interface(IScheduledWorkItem)
['{148BD524-A2AB-11CE-B11F-00AA00530503}']
Function SetApplicationName(pwszApplicationName: LPCWSTR): HRESULT; stdcall;
Function GetApplicationName(ppwszApplicationName: PLPWSTR): HRESULT; stdcall;
Function SetParameters(pwszParameters: LPCWSTR): HRESULT; stdcall;
Function GetParameters(ppwszParameters: PLPWSTR): HRESULT; stdcall;
Function SetWorkingDirectory(pwszWorkingDirectory: LPCWSTR): HRESULT; stdcall;
Function GetWorkingDirectory(ppwszWorkingDirectory: PLPWSTR): HRESULT; stdcall;
Function SetPriority(dwPriority: DWORD): HRESULT; stdcall;
Function GetPriority(pdwPriority: PDWORD): HRESULT; stdcall;
Function SetTaskFlags(dwFlags: DWORD): HRESULT; stdcall;
Function GetTaskFlags(pdwFlags: PDWORD): HRESULT; stdcall;
Function SetMaxRunTime(dwMaxRunTime: DWORD): HRESULT; stdcall;
Function GetMaxRunTime(pdwMaxRunTime: PDWORD): HRESULT; stdcall;
end;
{-------------------------------------------------------------------------------
Interface: IEnumWorkItems
Synopsis: Work item object enumerator. Enumerates the work item objects
within the Tasks folder.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa380706
}
PIEnumWorkItems = ^IEnumWorkItems;
IEnumWorkItems = interface(IUnknown)
['{148BD528-A2AB-11CE-B11F-00AA00530503}']
Function Next(celt: ULONG; rgpwszNames: PPLPWSTR; pceltFetched: PULONG): HRESULT; stdcall;
Function Skip(celt: ULONG): HRESULT; stdcall;
Function Reset: HRESULT; stdcall;
Function Clone(ppEnumWorkItems: PIEnumWorkItems): HRESULT; stdcall;
end;
{-------------------------------------------------------------------------------
Interface: ITaskScheduler
Synopsis: Task Scheduler interface. Provides location transparent
manipulation of task and/or queue objects within the Tasks
folder.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa381811
}
ITaskScheduler = interface(IUnknown)
['{148BD527-A2AB-11CE-B11F-00AA00530503}']
Function SetTargetComputer(pwszComputer: LPCWSTR): HRESULT; stdcall;
Function GetTargetComputer(ppwszComputer: PLPWSTR): HRESULT; stdcall;
Function Enum(ppEnumTasks: PIEnumWorkItems): HRESULT; stdcall;
Function Activate(pwszName: LPCWSTR; riid: REFIID; ppunk: PIUnknown): HRESULT; stdcall;
Function Delete(pwszName: LPCWSTR): HRESULT; stdcall;
Function NewWorkItem(pwszTaskName: LPCWSTR; rclsid: REFCLSID; riid: REFIID; ppunk: PIUnknown): HRESULT; stdcall;
Function AddWorkItem(pwszTaskName: LPCWSTR; pWorkItem: IScheduledWorkItem): HRESULT; stdcall;
Function IsOfType(pwszName: LPCWSTR; riid: REFIID): HRESULT; stdcall;
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const
CLSID_CTask: TGUID = '{148BD520-A2AB-11CE-B11F-00AA00530503}';
CLSID_CTaskScheduler: TGUID = '{148BD52A-A2AB-11CE-B11F-00AA00530503}';
type
{
https://msdn.microsoft.com/library/windows/desktop/aa382588
}
_TASKPAGE = (
TASKPAGE_TASK,
TASKPAGE_SCHEDULE,
TASKPAGE_SETTINGS);
TASKPAGE = _TASKPAGE;
{-------------------------------------------------------------------------------
Interface: IProvideTaskPage
Synopsis: Task property page retrieval interface. With this interface,
it is possible to retrieve one or more property pages
associated with a task object. Task objects inherit this
interface.
-------------------------------------------------------------------------------}
{
https://msdn.microsoft.com/library/windows/desktop/aa380749
}
IProvideTaskPage = interface(IUnknown)
['{4086658a-cbbb-11cf-b604-00c04fd8d565}']
Function GetPage(tpType: TASKPAGE; fPersistChanges: BOOL; phPage: PHPROPSHEETPAGE): HRESULT; stdcall;
end;
//------------------------------------------------------------------------------
type
ISchedulingAgent = ITaskScheduler;
IEnumTasks = IEnumWorkItems;
const
IID_IPersistFile: TGUID = '{0000010b-0000-0000-C000-000000000046}';
IID_ISchedulingAgent: TGUID = '{148BD527-A2AB-11CE-B11F-00AA00530503}';
CLSID_CSchedulingAgent: TGUID = '{148BD52A-A2AB-11CE-B11F-00AA00530503}';
{===============================================================================
--------------------------------------------------------------------------------
Task Scheduler 2.0 (taskschd.h)
--------------------------------------------------------------------------------
===============================================================================}
{===============================================================================
Datatypes
===============================================================================}
const
{
https://msdn.microsoft.com/library/windows/desktop/aa383604
}
SCHED_S_TASK_READY = $00041300; // The task is ready to run at its next scheduled time.
SCHED_S_TASK_RUNNING = $00041301; // The task is currently running.
SCHED_S_TASK_DISABLED = $00041302; // The task will not run at the scheduled times because it has been disabled.
SCHED_S_TASK_HAS_NOT_RUN = $00041303; // The task has not yet run.
SCHED_S_TASK_NO_MORE_RUNS = $00041304; // There are no more runs scheduled for this task.
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.
SCHED_S_TASK_TERMINATED = $00041306; // The last run of the task was terminated by the user.
SCHED_S_TASK_NO_VALID_TRIGGERS = $00041307; // Either the task has no triggers or the existing triggers are disabled or not set.
SCHED_S_EVENT_TRIGGER = $00041308; // Event triggers do not have set run times.
SCHED_E_TRIGGER_NOT_FOUND = $80041309; // A task's trigger is not found.
SCHED_E_TASK_NOT_READY = $8004130A; // One or more of the properties required to run this task have not been set.
SCHED_E_TASK_NOT_RUNNING = $8004130B; // There is no running instance of the task.
SCHED_E_SERVICE_NOT_INSTALLED = $8004130C; // The Task Scheduler service is not installed on this computer.
SCHED_E_CANNOT_OPEN_TASK = $8004130D; // The task object could not be opened.
SCHED_E_INVALID_TASK = $8004130E; // The object is either an invalid task object or is not a task object.
SCHED_E_ACCOUNT_INFORMATION_NOT_SET = $8004130F; // No account information could be found in the Task Scheduler security database for the task indicated.
SCHED_E_ACCOUNT_NAME_NOT_FOUND = $80041310; // Unable to establish existence of the account specified.
SCHED_E_ACCOUNT_DBASE_CORRUPT = $80041311; // Corruption was detected in the Task Scheduler security database; the database has been reset.
SCHED_E_NO_SECURITY_SERVICES = $80041312; // Task Scheduler security services are available only on Windows NT.
SCHED_E_UNKNOWN_OBJECT_VERSION = $80041313; // The task object version is either unsupported or invalid.
SCHED_E_UNSUPPORTED_ACCOUNT_OPTION = $80041314; // The task has been configured with an unsupported combination of account settings and run time options.
SCHED_E_SERVICE_NOT_RUNNING = $80041315; // The Task Scheduler Service is not running.
SCHED_E_UNEXPECTEDNODE = $80041316; // The task XML contains an unexpected node.
SCHED_E_NAMESPACE = $80041317; // The task XML contains an element or attribute from an unexpected namespace.
SCHED_E_INVALIDVALUE = $80041318; // The task XML contains a value which is incorrectly formatted or out of range.
SCHED_E_MISSINGNODE = $80041319; // The task XML is missing a required element or attribute.
SCHED_E_MALFORMEDXML = $8004131A; // The task XML is malformed.
SCHED_S_SOME_TRIGGERS_FAILED = $0004131B; // The task is registered, but not all specified triggers will start the task.
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.
SCHED_E_TOO_MANY_NODES = $8004131D; // The task XML contains too many nodes of the same type.
SCHED_E_PAST_END_BOUNDARY = $8004131E; // The task cannot be started after the trigger end boundary.
SCHED_E_ALREADY_RUNNING = $8004131F; // An instance of this task is already running.
SCHED_E_USER_NOT_LOGGED_ON = $80041320; // The task will not run because the user is not logged on.
SCHED_E_INVALID_TASK_HASH = $80041321; // The task image is corrupt or has been tampered with.
SCHED_E_SERVICE_NOT_AVAILABLE = $80041322; // The Task Scheduler service is not available.
SCHED_E_SERVICE_TOO_BUSY = $80041323; // The Task Scheduler service is too busy to handle your request. Please try again later.
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.
SCHED_S_TASK_QUEUED = $00041325; // The Task Scheduler service has asked the task to run.
SCHED_E_TASK_DISABLED = $80041326; // The task is disabled.
SCHED_E_TASK_NOT_V1_COMPAT = $80041327; // The task has properties that are not compatible with earlier versions of Windows.
SCHED_E_START_ON_DEMAND = $80041328; // The task settings do not allow the task to start on demand.
//==============================================================================
type
{
https://msdn.microsoft.com/library/windows/desktop/aa383574
}
_TASK_RUN_FLAGS = (
TASK_RUN_NO_FLAGS = 0,
TASK_RUN_AS_SELF = $1,
TASK_RUN_IGNORE_CONSTRAINTS = $2,
TASK_RUN_USE_SESSION_ID = $4,
TASK_RUN_USER_SID = $8);
TASK_RUN_FLAGS = _TASK_RUN_FLAGS;
{
https://msdn.microsoft.com/library/windows/desktop/aa383558
}
_TASK_ENUM_FLAGS = (
TASK_ENUM_HIDDEN = $1);
TASK_ENUM_FLAGS = _TASK_ENUM_FLAGS;
{
https://msdn.microsoft.com/library/windows/desktop/aa383566
}
_TASK_LOGON_TYPE = (
TASK_LOGON_NONE,
TASK_LOGON_PASSWORD,
TASK_LOGON_S4U,
TASK_LOGON_INTERACTIVE_TOKEN,
TASK_LOGON_GROUP,
TASK_LOGON_SERVICE_ACCOUNT,
TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD);
TASK_LOGON_TYPE = _TASK_LOGON_TYPE;
{
https://msdn.microsoft.com/library/windows/desktop/aa383572
}
_TASK_RUNLEVEL = (
TASK_RUNLEVEL_LUA,
TASK_RUNLEVEL_HIGHEST);
TASK_RUNLEVEL_TYPE = _TASK_RUNLEVEL;
{
https://msdn.microsoft.com/library/windows/desktop/ee695874
}
_TASK_PROCESSTOKENSID = (
TASK_PROCESSTOKENSID_NONE,
TASK_PROCESSTOKENSID_UNRESTRICTED,
TASK_PROCESSTOKENSID_DEFAULT);
TASK_PROCESSTOKENSID_TYPE = _TASK_PROCESSTOKENSID;
{
https://msdn.microsoft.com/library/windows/desktop/aa383617
}
_TASK_STATE = (
TASK_STATE_UNKNOWN,
TASK_STATE_DISABLED,
TASK_STATE_QUEUED,
TASK_STATE_READY,
TASK_STATE_RUNNING);
TASK_STATE = _TASK_STATE;
{
https://msdn.microsoft.com/library/windows/desktop/aa382538
}
_TASK_CREATION = (
TASK_VALIDATE_ONLY = $1,
TASK_CREATE = $2,
TASK_UPDATE = $4,
TASK_CREATE_OR_UPDATE = LongWord(TASK_CREATE) or
LongWord(TASK_UPDATE),
TASK_DISABLE = $8,
TASK_DONT_ADD_PRINCIPAL_ACE = $10,
TASK_IGNORE_REGISTRATION_TRIGGERS = $20);
TASK_CREATION = _TASK_CREATION;
{
https://msdn.microsoft.com/library/windows/desktop/aa383915
}
_TASK_TRIGGER_TYPE2 = (
TASK_TRIGGER_EVENT = 0,
TASK_TRIGGER_TIME = 1,
TASK_TRIGGER_DAILY = 2,
TASK_TRIGGER_WEEKLY = 3,
TASK_TRIGGER_MONTHLY = 4,
TASK_TRIGGER_MONTHLYDOW = 5,
TASK_TRIGGER_IDLE = 6,
TASK_TRIGGER_REGISTRATION = 7,
TASK_TRIGGER_BOOT = 8,
TASK_TRIGGER_LOGON = 9,
TASK_TRIGGER_SESSION_STATE_CHANGE = 11,
TASK_TRIGGER_CUSTOM_TRIGGER_01 = 12);
TASK_TRIGGER_TYPE2 = _TASK_TRIGGER_TYPE2;
{
https://msdn.microsoft.com/library/windows/desktop/aa383616
}
_TASK_SESSION_STATE_CHANGE_TYPE = (
TASK_CONSOLE_CONNECT = 1,
TASK_CONSOLE_DISCONNECT = 2,
TASK_REMOTE_CONNECT = 3,
TASK_REMOTE_DISCONNECT = 4,
TASK_SESSION_LOCK = 7,
TASK_SESSION_UNLOCK = 8);
TASK_SESSION_STATE_CHANGE_TYPE = _TASK_SESSION_STATE_CHANGE_TYPE;
{
https://msdn.microsoft.com/library/windows/desktop/aa383553
}
_TASK_ACTION_TYPE = (
TASK_ACTION_EXEC = 0,
TASK_ACTION_COM_HANDLER = 5,
TASK_ACTION_SEND_EMAIL = 6,
TASK_ACTION_SHOW_MESSAGE = 7);
TASK_ACTION_TYPE = _TASK_ACTION_TYPE;
{
https://msdn.microsoft.com/library/windows/desktop/aa383563
}
_TASK_INSTANCES_POLICY = (
TASK_INSTANCES_PARALLEL,
TASK_INSTANCES_QUEUE,
TASK_INSTANCES_IGNORE_NEW,
TASK_INSTANCES_STOP_EXISTING);
TASK_INSTANCES_POLICY = _TASK_INSTANCES_POLICY;
{
https://msdn.microsoft.com/library/windows/desktop/aa383557
}
_TASK_COMPATIBILITY = (
TASK_COMPATIBILITY_AT,
TASK_COMPATIBILITY_V1,
TASK_COMPATIBILITY_V2,
TASK_COMPATIBILITY_V2_1,
TASK_COMPATIBILITY_V2_2,
TASK_COMPATIBILITY_V2_3);
TASK_COMPATIBILITY = _TASK_COMPATIBILITY;
{===============================================================================
Interfaces
===============================================================================}
const
IID_IRunningTask: TGUID = '{653758fb-7b9a-4f1e-a471-beeb8e9b834e}';
IID_IRunningTaskCollection: TGUID = '{6a67614b-6828-4fec-aa54-6d52e8f1f2db}';
IID_IRegistrationInfo: TGUID = '{416D8B73-CB41-4ea1-805C-9BE9A5AC4A74}';
IID_IRepetitionPattern: TGUID = '{7FB9ACF1-26BE-400e-85B5-294B9C75DFD6}';
IID_ITaskNamedValuePair: TGUID = '{39038068-2B46-4afd-8662-7BB6F868D221}';
IID_ITaskNamedValueCollection: TGUID = '{B4EF826B-63C3-46e4-A504-EF69E4F7EA4D}';
IID_ITrigger: TGUID = '{09941815-ea89-4b5b-89e0-2a773801fac3}';
IID_ITriggerCollection: TGUID = '{85df5081-1b24-4f32-878a-d9d14df4cb77}';
IID_IBootTrigger: TGUID = '{2A9C35DA-D357-41f4-BBC1-207AC1B1F3CB}';
IID_IDailyTrigger: TGUID = '{126c5cd8-b288-41d5-8dbf-e491446adc5c}';
IID_IEventTrigger: TGUID = '{d45b0167-9653-4eef-b94f-0732ca7af251}';
IID_IIdleTrigger: TGUID = '{d537d2b0-9fb3-4d34-9739-1ff5ce7b1ef3}';
IID_ILogonTrigger: TGUID = '{72DADE38-FAE4-4b3e-BAF4-5D009AF02B1C}';
IID_IMonthlyDOWTrigger: TGUID = '{77d025a3-90fa-43aa-b52e-cda5499b946a}';
IID_IMonthlyTrigger: TGUID = '{97c45ef1-6b02-4a1a-9c0e-1ebfba1500ac}';
IID_IRegistrationTrigger: TGUID = '{4c8fec3a-c218-4e0c-b23d-629024db91a2}';
IID_ISessionStateChangeTrigger: TGUID = '{754DA71B-4385-4475-9DD9-598294FA3641}';
IID_ITimeTrigger: TGUID = '{b45747e0-eba7-4276-9f29-85c5bb300006}';
IID_IWeeklyTrigger: TGUID = '{5038fc98-82ff-436d-8728-a512a57c9dc1}';
IID_IIdleSettings: TGUID = '{84594461-0053-4342-A8FD-088FABF11F32}';
IID_INetworkSettings: TGUID = '{9F7DEA84-C30B-4245-80B6-00E9F646F1B4}';
IID_IMaintenanceSettings: TGUID = '{A6024FA8-9652-4ADB-A6BF-5CFCD877A7BA}';
IID_ITaskSettings: TGUID = '{8FD4711D-2D02-4c8c-87E3-EFF699DE127E}';
IID_ITaskSettings2: TGUID = '{2C05C3F0-6EED-4c05-A15F-ED7D7A98A369}';
IID_ITaskSettings3: TGUID = '{0AD9D0D7-0C7F-4EBB-9A5F-D1C648DCA528}';
IID_IPrincipal: TGUID = '{D98D51E5-C9B4-496a-A9C1-18980261CF0F}';
IID_IPrincipal2: TGUID = '{248919AE-E345-4A6D-8AEB-E0D3165C904E}';
IID_IAction: TGUID = '{BAE54997-48B1-4cbe-9965-D6BE263EBEA4}';
IID_IActionCollection: TGUID = '{02820E19-7B98-4ed2-B2E8-FDCCCEFF619B}';
IID_IComHandlerAction: TGUID = '{6D2FD252-75C5-4f66-90BA-2A7D8CC3039F}';
IID_IEmailAction: TGUID = '{10F62C64-7E16-4314-A0C2-0C3683F99D40}';
IID_IExecAction: TGUID = '{4c3d624d-fd6b-49a3-b9b7-09cb3cd3f047}';
IID_IShowMessageAction: TGUID = '{505E9E68-AF89-46b8-A30F-56162A83D537}';
IID_ITaskDefinition: TGUID = '{f5bc8fc5-536d-4f77-b852-fbc1356fdeb6}';
IID_IRegisteredTask: TGUID = '{9c86f320-dee3-4dd1-b972-a303f26b061e}';
IID_IRegisteredTaskCollection: TGUID = '{86627eb4-42a7-41e4-a4d9-ac33a72f2d52}';
IID_ITaskFolder: TGUID = '{8cfac062-a080-4c15-9a88-aa7c2af80dfc}';
IID_ITaskFolderCollection: TGUID = '{79184a66-8664-423f-97f1-637356a5d812}';
IID_ITaskService: TGUID = '{2faba4c7-4da9-4013-9697-20cc3fd40f85}';
IID_ITaskHandler: TGUID = '{839d7762-5121-4009-9234-4f0d19394f04}';
IID_ITaskHandlerStatus: TGUID = '{eaec7a8f-27a0-4ddc-8675-14726a01a38a}';
IID_ITaskVariables: TGUID = '{3e4c9351-d966-4b8b-bb87-ceba68bb0107}';
CLSID_TaskScheduler: TGUID = '{0f87369f-a4e5-4cfc-bd3e-73e6154572dd}';
CLSID_TaskHandlerPS: TGUID = '{f2a69db7-da2c-4352-9066-86fee6dacac9}';
CLSID_TaskHandlerStatusPS: TGUID = '{9f15266d-d7ba-48f0-93c1-e6895f6fe5ac}';
type
// forward declarations to resolve circular references
ITaskFolderCollection = interface; PITaskFolderCollection = ^ITaskFolderCollection;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381157
}
PIRunningTask = ^IRunningTask;
IRunningTask = interface(IDispatch)
['{653758fb-7b9a-4f1e-a471-beeb8e9b834e}']
Function get_Name: BSTR; safecall;
Function get_InstanceGuid: BSTR; safecall;
Function get_Path: BSTR; safecall;
Function get_State: TASK_STATE; safecall;
Function get_CurrentAction: BSTR; safecall;
Function Stop: HRESULT; stdcall;
Function Refresh: HRESULT; stdcall;
Function get_EnginePID: DWORD; safecall;
property Name: BSTR read get_Name;
property InstanceGuid: BSTR read get_InstanceGuid;
property Path: BSTR read get_Path;
property State: TASK_STATE read get_State;
property CurrentAction: BSTR read get_CurrentAction;
property EnginePID: DWORD read get_EnginePID;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381166
}
PIRunningTaskCollection = ^IRunningTaskCollection;
IRunningTaskCollection = interface(IDispatch)
['{6a67614b-6828-4fec-aa54-6d52e8f1f2db}']
Function get_Count: LONG; safecall;
Function get_Item(index: OleVariant): IRunningTask; safecall;
Function get__NewEnum: IUnknown; safecall;
property Count: LONG read get_Count;
property Item[index: OleVariant]: IRunningTask read get_Item;
property _NewEnum: IUnknown read get__NewEnum;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380773
}
IRegistrationInfo = interface(IDispatch)
['{416D8B73-CB41-4ea1-805C-9BE9A5AC4A74}']
Function get_Description: BSTR; safecall;
procedure put_Description(description: BSTR); safecall;
Function get_Author: BSTR; safecall;
procedure put_Author(author: BSTR); safecall;
Function get_Version: BSTR; safecall;
procedure put_Version(version: BSTR); safecall;
Function get_Date: BSTR; safecall;
procedure put_Date(date: BSTR); safecall;
Function get_Documentation: BSTR; safecall;
procedure put_Documentation(documentation: BSTR); safecall;
Function get_XmlText: BSTR; safecall;
procedure put_XmlText(text: BSTR); safecall;
Function get_URI: BSTR; safecall;
procedure put_URI(Uri: BSTR); safecall;
Function get_SecurityDescriptor: OleVariant; safecall;
procedure put_SecurityDescriptor(sddl: OleVariant); safecall;
Function get_Source: BSTR; safecall;
procedure put_Source(source: BSTR); safecall;
property Description: BSTR read get_Description write put_Description;
property Author: BSTR read get_Author write put_Author;
property Version: BSTR read get_Version write put_Version;
property Date: BSTR read get_Date write put_Date;
property Documentation: BSTR read get_Documentation write put_Documentation;
property XmlText: BSTR read get_XmlText write put_XmlText;
property URI: BSTR read get_URI write put_URI;
property SecurityDescriptor: OleVariant read get_SecurityDescriptor write put_SecurityDescriptor;
property Source: BSTR read get_Source write put_Source;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381128
}
IRepetitionPattern = interface(IDispatch)
['{7FB9ACF1-26BE-400e-85B5-294B9C75DFD6}']
Function get_Interval: BSTR; safecall;
procedure put_Interval(interval: BSTR); safecall;
Function get_Duration: BSTR; safecall;
procedure put_Duration(duration: BSTR); safecall;
Function get_StopAtDurationEnd: VARIANT_BOOL; safecall;
procedure put_StopAtDurationEnd(stop: VARIANT_BOOL); safecall;
property Interval: BSTR read get_Interval write put_Interval;
property Duration: BSTR read get_Duration write put_Duration;
property StopAtDurationEnd: VARIANT_BOOL read get_StopAtDurationEnd write put_StopAtDurationEnd;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381804
}
PITaskNamedValuePair = ^ITaskNamedValuePair;
ITaskNamedValuePair = interface(IDispatch)
['{39038068-2B46-4afd-8662-7BB6F868D221}']
Function get_Name: BSTR; safecall;
procedure put_Name(name: BSTR); safecall;
Function get_Value: BSTR; safecall;
procedure put_Value(value: BSTR); safecall;
property Name: BSTR read get_Name write put_Name;
property Value: BSTR read get_Value write put_Value;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381392
}
ITaskNamedValueCollection = interface(IDispatch)
['{B4EF826B-63C3-46e4-A504-EF69E4F7EA4D}']
Function get_Count: LONG; safecall;
Function get_Item(index: LONG): ITaskNamedValuePair; safecall;
Function get__NewEnum: IUnknown; safecall;
Function Create(name, value: BSTR; ppPair: PITaskNamedValuePair): HRESULT; stdcall;
Function Remove(index: LONG): HRESULT; stdcall;
Function Clear: HRESULT; stdcall;
property Count: LONG read get_Count;
property Item[index: LONG]: ITaskNamedValuePair read get_Item;
property _NewEnum: IUnknown read get__NewEnum;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381887
}
PITrigger = ^ITrigger;
ITrigger = interface(IDispatch)
['{09941815-ea89-4b5b-89e0-2a773801fac3}']
Function get_Type: TASK_TRIGGER_TYPE2; safecall;
Function get_Id: BSTR; safecall;
procedure put_Id(id: BSTR); safecall;
Function get_Repetition: IRepetitionPattern; safecall;
procedure put_Repetition(pRepeat: IRepetitionPattern); safecall;
Function get_ExecutionTimeLimit: BSTR; safecall;
procedure put_ExecutionTimeLimit(timelimit: BSTR); safecall;
Function get_StartBoundary: BSTR; safecall;
procedure put_StartBoundary(start: BSTR); safecall;
Function get_EndBoundary: BSTR; safecall;
procedure put_EndBoundary(end_: BSTR); safecall;
Function get_Enabled: VARIANT_BOOL; safecall;
procedure put_Enabled(enabled: VARIANT_BOOL); safecall;
property TriggerType: TASK_TRIGGER_TYPE2 read get_Type;
property Id: BSTR read get_Id write put_Id;
property Repetition: IRepetitionPattern read get_Repetition write put_Repetition;
property ExecutionTimeLimit: BSTR read get_ExecutionTimeLimit write put_ExecutionTimeLimit;
property StartBoundary: BSTR read get_StartBoundary write put_StartBoundary;
property EndBoundary: BSTR read get_EndBoundary write put_EndBoundary;
property Enabled: VARIANT_BOOL read get_Enabled write put_Enabled;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381889
}
ITriggerCollection = interface(IDispatch)
['{85df5081-1b24-4f32-878a-d9d14df4cb77}']
Function get_Count: LONG; safecall;
Function get_Item(index: LONG): ITrigger; safecall;
Function get__NewEnum: IUnknown; safecall;
Function Create(type_: TASK_TRIGGER_TYPE2; ppTrigger: PITrigger): HRESULT; stdcall;
Function Remove(index: OleVariant): HRESULT; stdcall;
Function Clear: HRESULT; stdcall;
property Count: LONG read get_Count;
property Item[index: LONG]: ITrigger read get_Item;
property _NewEnum: IUnknown read get__NewEnum;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380603
}
IBootTrigger = interface(ITrigger)
['{2A9C35DA-D357-41f4-BBC1-207AC1B1F3CB}']
Function get_Delay: BSTR; safecall;
procedure put_Delay(delay: BSTR); safecall;
property Delay: BSTR read get_Delay write put_Delay;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380656
}
IDailyTrigger = interface(ITrigger)
['{126c5cd8-b288-41d5-8dbf-e491446adc5c}']
Function get_DaysInterval: SHORT; safecall;
procedure put_DaysInterval(days: SHORT); safecall;
Function get_RandomDelay: BSTR; safecall;
procedure put_RandomDelay(randomDelay: BSTR); safecall;
property DaysInterval: SHORT read get_DaysInterval write put_DaysInterval;
property RandomDelay: BSTR read get_RandomDelay write put_RandomDelay;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380711
}
IEventTrigger = interface(ITrigger)
['{d45b0167-9653-4eef-b94f-0732ca7af251}']
Function get_Subscription: BSTR; safecall;
procedure put_Subscription(query: BSTR); safecall;
Function get_Delay: BSTR; safecall;
procedure put_Delay(delay: BSTR); safecall;
Function get_ValueQueries: ITaskNamedValueCollection; safecall;
procedure put_ValueQueries(pNamedXPaths: ITaskNamedValueCollection); safecall;
property Subscription: BSTR read get_Subscription write put_Subscription;
property Delay: BSTR read get_Delay write put_Delay;
property ValueQueries: ITaskNamedValueCollection read get_ValueQueries write put_ValueQueries;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380724
}
IIdleTrigger = interface(ITrigger)
['{d537d2b0-9fb3-4d34-9739-1ff5ce7b1ef3}']
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380725
}
ILogonTrigger = interface(ITrigger)
['{72DADE38-FAE4-4b3e-BAF4-5D009AF02B1C}']
Function get_Delay: BSTR; safecall;
procedure put_Delay(delay: BSTR); safecall;
Function get_UserId: BSTR; safecall;
procedure put_UserId(user: BSTR); safecall;
property Delay: BSTR read get_Delay write put_Delay;
property UserId: BSTR read get_UserId write put_UserId;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380728
}
IMonthlyDOWTrigger = interface(ITrigger)
['{77d025a3-90fa-43aa-b52e-cda5499b946a}']
Function get_DaysOfWeek: SHORT; safecall;
procedure put_DaysOfWeek(days: SHORT); safecall;
Function get_WeeksOfMonth: SHORT; safecall;
procedure put_WeeksOfMonth(weeks: SHORT); safecall;
Function get_MonthsOfYear: SHORT; safecall;
procedure put_MonthsOfYear(months: SHORT); safecall;
Function get_RunOnLastWeekOfMonth: VARIANT_BOOL; safecall;
procedure put_RunOnLastWeekOfMonth(lastWeek: VARIANT_BOOL); safecall;
Function get_RandomDelay: BSTR; safecall;
procedure put_RandomDelay(randomDelay: BSTR); safecall;
property DaysOfWeek: SHORT read get_DaysOfWeek write put_DaysOfWeek;
property WeeksOfMonth: SHORT read get_WeeksOfMonth write put_WeeksOfMonth;
property MonthsOfYear: SHORT read get_MonthsOfYear write put_MonthsOfYear;
property RunOnLastWeekOfMonth: VARIANT_BOOL read get_RunOnLastWeekOfMonth write put_RunOnLastWeekOfMonth;
property RandomDelay: BSTR read get_RandomDelay write put_RandomDelay;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa380734
}
IMonthlyTrigger = interface(ITrigger)
['{97c45ef1-6b02-4a1a-9c0e-1ebfba1500ac}']
Function get_DaysOfMonth: LONG; safecall;
procedure put_DaysOfMonth(days: LONG); safecall;
Function get_MonthsOfYear: SHORT; safecall;
procedure put_MonthsOfYear(months: SHORT); safecall;
Function get_RunOnLastDayOfMonth: VARIANT_BOOL; safecall;
procedure put_RunOnLastDayOfMonth(lastDay: VARIANT_BOOL); safecall;
Function get_RandomDelay: BSTR; safecall;
procedure put_RandomDelay(randomDelay: BSTR); safecall;
property DaysOfMonth: LONG read get_DaysOfMonth write put_DaysOfMonth;
property MonthsOfYear: SHORT read get_MonthsOfYear write put_MonthsOfYear;
property RunOnLastDayOfMonth: VARIANT_BOOL read get_RunOnLastDayOfMonth write put_RunOnLastDayOfMonth;
property RandomDelay: BSTR read get_RandomDelay write put_RandomDelay;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381104
}
IRegistrationTrigger = interface(ITrigger)
['{4c8fec3a-c218-4e0c-b23d-629024db91a2}']
Function get_Delay: BSTR; safecall;
procedure put_Delay(delay: BSTR); safecall;
property Delay: BSTR read get_Delay write put_Delay;
end;
//------------------------------------------------------------------------------
{
https://msdn.microsoft.com/library/windows/desktop/aa381292