IScheduledWorkItem::CreateTrigger method (mstask.h)
[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]
Creates a trigger for the work item.
Syntax
HRESULT CreateTrigger(
[out] WORD *piNewTrigger,
[out] ITaskTrigger **ppTrigger
);
Parameters
[out] piNewTrigger
A pointer to the returned trigger index value of the new trigger. The trigger index for the first trigger associated with a work item is "0". See Remarks for other uses of the trigger index.
[out] ppTrigger
A pointer to a pointer to an ITaskTrigger interface. Currently, the only supported work items are tasks.
Return value
The CreateTrigger method returns one of the following values.
Return code | Description |
---|---|
|
The operation was successful. |
|
The arguments are not valid. |
|
Not enough memory is available. |
Remarks
You use the trigger index returned by piNewTrigger when you are either retrieving or deleting triggers. However, the trigger index is not an identifier. It indicates only the new trigger's position relative to the other current triggers associated with the work item.
To set the criteria for the new trigger, call ITaskTrigger::SetTrigger.
After creating a new trigger for a work item, applications must call the IPersistFile::Save method to save the new trigger to disk.
Examples
For an example of how to set the trigger criteria when creating a new trigger, see Creating a New Trigger.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | mstask.h |
Library | Mstask.lib |
DLL | Mstask.dll |
Redistributable | Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95 |
See also
IScheduledWorkItem::DeleteTrigger
IScheduledWorkItem::GetTrigger