Reputation: 16874
I know I can have the child process monitor the parent. Is there to have Windows do this automatically? After all, it does track the process launch hierarchy.
Upvotes: 2
Views: 193
Reputation: 1339
You cannot do this nativly through C#. You will need to use PInvoke to call the Win32 Job API.
The API calls are in this answer: How do I automatically destroy child processes in Windows?
Upvotes: 3
Reputation: 136441
You can use Jobs, try the SetInformationJobObject
function, the key is use the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
value in the LimitFlags
member of the _JOBOBJECT_BASIC_LIMIT_INFORMATION struct passed to the function.
Upvotes: 3