DebugSetProcessKillOnExit function (winbase.h)

Sets the action to be performed when the calling thread exits.


BOOL DebugSetProcessKillOnExit(
  [in] BOOL KillOnExit


[in] KillOnExit

If this parameter is TRUE, the thread terminates all attached processes on exit (note that this is the default). Otherwise, the thread detaches from all processes being debugged on exit.

Return value

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.


The calling thread must have established at least one debugging connection using the CreateProcess or DebugActiveProcess function before calling this function. DebugSetProcessKillOnExit affects all current and future debuggees connected to the calling thread. A thread can call this function multiple times to change the action as needed.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also


Debugging Functions