Retrieving Trigger Strings Example
The following example shows how to use IScheduledWorkItem::GetTriggerString to display the strings of all triggers associated with a known task.
The following procedure describes how to retrieve the trigger strings of a task.
To retrieve the trigger strings of a task
- Call CoInitialize to initialize the COM library and CoCreateInstance to get a Task Scheduler object. (This example assumes that the Task Scheduler service is running.)
- Call ITaskScheduler::Activate to get the ITask interface of the task object. (Note that this example gets the "Test Task" task.)
- Call ITask::GetTriggerCount to find out how many triggers are associated with a task. (Note that GetTriggerCount is an IScheduledWorkItem method inherited by ITask.)
- Display the trigger strings, calling ITask::GetTriggerString for each trigger associated with the task. (Note that GetTriggerString is an IScheduledWorkItem method inherited by ITask.)
- Release all resources. Call CoTaskMemFree to release the trigger strings and ITask::Release to release the ITask interface. (Note that Release is an IUnknown method inherited by ITask.)
|For a code example of||See|
|Retrieving a trigger string for all the triggers associated with a known task||Code Example: Retrieving Trigger Strings|