TerminateExecutable

int TerminateExecutable (int executableHandle);

Purpose

Terminates an executable if it has not already terminated.

This function calls TerminateProcess to terminate the process. DLLs loaded by the process being terminated are not given a chance to cleanup. Exit a process using the ExitProcess function rather than terminating the process using TerminateProcess.

Parameters

Input
Name Type Description
executableHandle integer Executable handle acquired from LaunchExecutableEx.

Return Value

Name Type Description
status integer Result of the operation.

Code Description
-1 Handle is invalid.
0 Handle is valid.

To determine if the function actually terminated the executable, use ExecutableHasTerminated.