IScheduledWorkItem::CreateTrigger method

Creates a trigger for the work item.

Syntax


HRESULT CreateTrigger(
  [out]  WORD *piNewTrigger,
  [out]  ITaskTrigger **ppTrigger
);

Parameters

piNewTrigger [out]

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.

ppTrigger [out]

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 codeDescription
S_OK

The operation was successful.

E_INVALIDARG

The arguments are not valid.

E_OUTOFMEMORY

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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Redistributable

Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95

Header

Mstask.h

Library

Mstask.lib

DLL

Mstask.dll

See also

IPersistFile::Save
IScheduledWorkItem
IScheduledWorkItem::DeleteTrigger
IScheduledWorkItem::GetTrigger
IScheduledWorkItem::GetTriggerString
ITaskTrigger
ITaskTrigger::SetTrigger

 

 

Community Additions

ADD
Show:
© 2014 Microsoft