DosKillProcess

Syntax
rc = DosKillProcess( ulAction, pid );

Parameters

 * ULONG ulAction (input)
 * Sets the processes to be terminated. Values are:

Value Name             Description 0     DKP_PROCESSTREE  Kill the process and all its descendant processes. Must be either the current process or it must have been created by the current process using DosExecPgm with ulFlagS set to EXEC_ASYNCRESULT (2). 1     DKP_PROCESS      Any process and only that process.
 * PID pid (input): Process ID for the process to be killed.

Returns
APIRET   rc 0         NO_ERROR 13       ERROR_INVALID_DATA 217      ERROR_ZOMBIE_PROCESS 303      ERROR_INVALID_PROCID 305      ERROR_NOT_DESCENDANT

Include Info

 * 1) define INCL_DOSPROCESS
 * 2) include 

Usage Explanation
DosKillProcess is used to kill a process by its process ID. What happens is that a KILLPROCESS exception is sent to the given process or group of processes. This by default will write all file buffers, and handles opened by the process will be closed. It is possible to intercept the exception with the use of DosSetExceptionHandler, and then the process will do its own nice exit and call DosExit. If another process has issued a DosWaitChild for a process terminated it will get termination code "Unintercepted DosKillProcess" (TC_KILLPROCESS = 3). ERROR_ZOMBIE_PROCESS indicates that the specified process has ended, but its parent has not yet issued DosWaitChild to get its return code.