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.

Syntax

HRESULT GetStatus(
  HRESULT *phrStatus
);

Parameters

phrStatus

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

SCHED_S_TASK_READY

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

SCHED_S_TASK_RUNNING

The work item is currently running.

SCHED_S_TASK_NOT_SCHEDULED

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

SCHED_S_TASK_HAS_NOT_RUN

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.

SCHED_S_TASK_DISABLED

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

SCHED_S_TASK_NO_MORE_RUNS

There are no more runs scheduled for this task.

SCHED_S_TASK_NO_VALID_TRIGGERS

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
S_OK
The operation was successful. The request was sent. For more information, see Remarks.
E_INVALIDARG
The arguments are not valid.

Remarks

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.

Examples

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.

Requirements

   
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

ITask