IScheduledWorkItem::Run 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.] ]

Sends a request to the Task Scheduler service to run the work item.

Syntax

HRESULT Run();

Return value

The Run method returns one of the following values.

Return code Description
S_OK
The operation was successful. The request was sent. For more information, see Remarks.
E_INVALIDARG
The arguments are not valid.
E_OUTOFMEMORY
Not enough memory is available.

Remarks

Run is an asynchronous operation. A return code of S_OK means that the request to run the work item has been made; it does not mean that the work item has started running. There may be a delay of a few seconds after Run returns before the work item actually starts running.

To determine whether the work item is running, call IScheduledWorkItem::GetStatus.

Examples

For an example of how to start a task, see Starting a Task Example.

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

IScheduledWorkItem::GetStatus

ITask