BOOL GetExitCodeProcess(hProcess, lpdwExitCode) | |||||
HANDLE hProcess; | /* handle for the process | */ | |||
LPDWORD lpdwExitCode; | /* address of the exit code | */ |
The GetExitCodeProcess function retrieves the termination status of the specified process.
hProcess
Identifies the process to retrieve termination status for. The process must have been created with PROCESS_QUERY_INFORMATION access.
lpdwExitCode
Points to a variable for the process exit code.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
If a process is in the signaled state, calling this function returns the termination status of the last thread in the process. If the process is in the not signaled state, the termination status returned is STILL_ACTIVE.
The process exit code may be the value passed to the ExitProcess function, the return value from the application's main function, or the exception code for an unhandled exception that caused the application to terminate.
ExitProcess, ExitThread, TerminateProcess