ITaskService::NewTask method

Returns an empty task definition object to be filled in with settings and properties and then registered using the ITaskFolder::RegisterTaskDefinition method.

Syntax

HRESULT NewTask(
  DWORD           flags,
  ITaskDefinition **ppDefinition
);

Parameters

flags

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

ppDefinition

The task definition that specifies all the information required to create a new task.

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

The returned ITaskDefinition pointer must be released after it is used.

Return Value

This method can return one of these values.

Return code/value Description
S_OK
0x0
The method returned successfully without error.
E_POINTER
0x80004003
NULL was passed in to the ppDefinition parameter. Pass in a reference to a NULL ITaskDefinition interface pointer.
E_INVALIDARG
0x80070057
A nonzero value was passed into the flags parameter.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header taskschd.h
Library Taskschd.lib
DLL Taskschd.dll

See Also

ITaskService