IScheduledWorkItem::GetStatus method

[[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.] ]

Retrieves the status of the work item.


HRESULT GetStatus(
  HRESULT *phrStatus



A pointer to an HRESULT value that contains one of the following values on return.


The work item is ready to run at its next scheduled time.


The work item is currently running.


One or more of the properties that are needed to run this task on a schedule have not been set.


The task has not been run. This value is returned whenever the task has not been run, even if the task is ready to be run at the next scheduled time or the task is a recurring task.


The task will not run at the scheduled times because it has been disabled.


There are no more runs scheduled for this task.


Either the task has no triggers or the existing triggers are disabled or not set.

Return Value

The GetStatus method returns one of the following values.

Return code Description
The operation was successful. The request was sent. For more information, see Remarks.
The arguments are not valid.


The methods of the IScheduledWorkItem interface are inherited by the ITask interface. Consequently, IScheduledWorkItem::GetStatus is typically called through the ITask interface.

IScheduledWorkItem::GetStatus does not obtain the status of the task dynamically. ITaskScheduler::Activateshould be called to obtain a new IScheduledWorkItem interface, which is used to get an updated status. For more information, see the example for ITaskScheduler::Activate.


For an example of how to retrieve the status of a task, see C/C++ Code Example: Retrieving Task Status.

For an example of how to retrieve the task status as part of terminating the task, see Terminating a Task Example.


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