James L
James L

Reputation: 16874

How to launch other processes that dies when the parent does?

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

Answers (2)

Jared Shaver
Jared Shaver

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

RRUZ
RRUZ

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

Related Questions