This function terminates the specified process and all of its threads.
At a Glance
Header file: | Winbase.h |
Windows CE versions: | 1.0 and later |
Syntax
BOOL TerminateProcess(HANDLE hProcess, DWORD uExitCode);
Parameters
hProcess
Handle to the process to terminate.
uExitCode
Specifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process’s exit value. Use the GetExitCodeThread function to retrieve a thread’s exit value.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess.
TerminateProcess causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating.
Terminating a process causes the following:
Terminating a process does not cause child processes to be terminated.
Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed.
For Windows CE version 1.0, the uExitCode parameter is ignored because process exit codes are not supported.