IShellTaskScheduler::AddTask method

Adds a task to the scheduler's background queue.

Syntax

HRESULT AddTask(
  IRunnableTask  *prt,
  REFTASKOWNERID rtoid,
  DWORD_PTR      lParam,
  DWORD          dwPriority
);

Parameters

prt

Type: IRunnableTask*

A pointer to an instance of an IRunnableTask interface representing the task to add to the queue.

rtoid

Type: REFTASKOWNERID

A GUID identifying the owner of the task. This information can be used to group tasks for later counting or removal by owner.

lParam

Type: DWORD_PTR

A pointer to a user-defined DWORD value allowing the task to be identified within the tasks owned by rtoid. This is used to identify single tasks or to subgroup them, for instance associating the task with a particular item such as an item in a ListView. This parameter can be zero.

dwPriority

Type: DWORD

One of the following values assigning the task's priority. Response to this priority depends on the cooperation of the other tasks being executed. New tasks are inserted in the queue in priority order. If a task of a low priority is currently under execution when a higher priority task is added, the scheduler attempts to suspend the task under execution. That lower priority task is resumed when the higher priority task(s) are completed.

ITSAT_DEFAULT_PRIORITY

Accept the default priority assigned to the task by the scheduler.

ITSAT_MAX_PRIORITY

High priority.

ITSAT_MIN_PRIORITY

Low priority.

Return Value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll (version 5.0 or later)