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(
  [in]  DWORD           flags,
  [out] ITaskDefinition **ppDefinition
);

Parameters

flags [in]

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

ppDefinition [out]

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/valueDescription
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]

Header

Taskschd.h

Library

Taskschd.lib

DLL

Taskschd.dll

See also

ITaskService

 

 

Show: