IScheduledWorkItem::GetRunTimes 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 work item run times for a specified time period.

Syntax

HRESULT GetRunTimes(
  const LPSYSTEMTIME pstBegin,
  const LPSYSTEMTIME pstEnd,
  WORD               *pCount,
  LPSYSTEMTIME       *rgstTaskTimes
);

Parameters

pstBegin

A pointer to a SYSTEMTIME structure that contains the starting time of the time period to check. This value is inclusive.

pstEnd

A pointer to a SYSTEMTIME structure that contains the ending time of the time period to check. This value is exclusive. If NULL is passed for this value, the end time is infinite.

pCount

A pointer to a WORD value that specifies the number of run times to retrieve.

On input, this parameter contains the number of run times being requested. This can be a number of between 1 and TASK_MAX_RUN_TIMES.

On output, this parameter contains the number of run times retrieved.

rgstTaskTimes

A pointer to an array of SYSTEMTIME structures. A NULL LPSYSTEMTIME object should be passed into this parameter. On return, this array contains pCount run times. You must free this array by a calling the CoTaskMemFree function.

Return Value

The GetRunTimes method returns one of the following values.

Return code Description
S_OK
The requested number of run times was retrieved.
S_FALSE
The method succeeded, but fewer than the requested number of run times were retrieved. The number of run times retrieved is contained in the value pointed to by pCount. If the number of run times retrieved is zero, there are also no event-based triggers that can cause the work item to be executed during the specified time period.
SCHED_S_TASK_NO_VALID_TRIGGERS
The work item is enabled but has no valid triggers.
SCHED_S_TASK_DISABLED
The work item is disabled.
E_INVALIDARG
One or more of the arguments are invalid.
E_OUTOFMEMORY
There is insufficient memory to compute the result.

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