IScheduledWorkItem::GetExitCode method (mstask.h)
[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]
Retrieves the last exit code returned by the executable associated with the work item on its last run. The method also returns the exit code returned to Task Scheduler when it last attempted to run the work item.
Syntax
HRESULT GetExitCode(
[out] DWORD *pdwExitCode
);
Parameters
[out] pdwExitCode
A pointer to a DWORD value that is set to the last exit code for the work item. This is the exit code that the work item returned when it last stopped running. If the work item has never been started, 0 is returned.
Return value
The GetExitCode method returns the error from the last attempt to start the work item. Possible values include the following.
Return code | Description |
---|---|
|
The attempt to start the work item was successful. |
|
No attempt has ever been made to start this work item. |
|
The arguments are not valid. |
|
Not enough memory is available. |
Remarks
This method can return the following two pieces of information:
- The error or exit code that is returned by the executable that is being scheduled is returned in the pdwExitCode parameter.
- The error code that the Task Scheduler received when it tried to start the job is returned in the GetExitCode method call itself.
Examples
For an example of how to retrieve the creator of a task, see C/C++ Code Example: Retrieving Task Exit Code.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | mstask.h |
Library | Mstask.lib |
DLL | Mstask.dll |
Redistributable | Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95 |