IRegisteredTask::GetInstances method

Returns all instances of the currently running registered task.

Note  IRegisteredTask::GetInstances will only return instances of the currently running registered task that are running at or below a user's security context. For example, for members of the Administrators group, GetInstances will return all instances of the currently running registered task, but for members of the Users group, GetInstances will only return instances of the currently running registered task that are running under the Users group security context.
 

Syntax


HRESULT GetInstances(
        LONG                   flags,
  [out] IRunningTaskCollection **ppRunningTasks
);

Parameters

flags

This parameter is reserved for future use and must be set to 0.

ppRunningTasks [out]

An IRunningTaskCollection interface that contains all currently running instances of the task under the user's context.

Pass in a reference to a NULL IRunningTaskCollection interface pointer. Referencing a non-NULL pointer can cause a memory leak because the pointer will be overwritten.

Return value

This method can return one of these values.

Return codeDescription
S_OK

The operation completed successfully.

E_INVALIDARG

A non-null flag was passed into the flags parameter.

E_POINTER

NULL was passed into the ppRunningTasks parameter.

 

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Taskschd.h

Library

Taskschd.lib

DLL

Taskschd.dll

See also

IRunningTaskCollection
Task Scheduler
IRegisteredTask

 

 

Show: