Platform SDK: DLLs, Processes, and Threads

TerminateJobObject

The TerminateJobObject function terminates all processes currently associated with the job.

BOOL TerminateJobObject(
  HANDLE hJob,    // handle to job
  UINT uExitCode  // exit code
);

Parameters

hJob
[in] Handle to the job whose processes will be terminated. The CreateJobObject or OpenJobObject function returns this handle. This handle must have the JOB_OBJECT_TERMINATE access right. For more information, see Job Object Security and Access Rights.
uExitCode
[in] Specifies the exit code for the processes and threads terminated as a result of this call.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

It is not possible for any of the processes associated with the job to postpone or handle the termination. It is as if TerminateProcess were called for each process associated with the job.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Processes and Threads Overview, Process and Thread Functions, CreateJobObject, OpenJobObject, TerminateProcess