ITaskService::NewTask method (taskschd.h)
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
[in] flags
This parameter is reserved for future use and must be set to 0.
[out] 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 |
---|---|
|
The method returned successfully without error. |
|
NULL was passed in to the ppDefinition parameter. Pass in a reference to a NULL ITaskDefinition interface pointer. |
|
A nonzero value was passed into the flags parameter. |
Requirements
Requirement | Value |
---|---|
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 |