Windows does not know "child processes" as unix has: it only stores the PID
of the process that launched it for each process. So, the task manager
essentially loops through all processes, and builds a graph to terminate the
"child processes". You can do the same, but there is no switch or so that
would do that for you.
You'll need to PInvoke "CreateToolhelp32Snapshot" and "Process32First" for
that.
It's probably a lot easier to:
- store all the process objects in a list in the main exe, and kill them on
shutdown
- use app-domains instead of separate processes
- use background threads instead of processes
Niki
> Hello Everybody ,
> I have a Process.Start() method that launch a "main.exe" files .
[quoted text clipped - 13 lines]
>
> Hak?na k?
Hak?na k? - 31 May 2004 16:32 GMT
I have found a solution that work fine for me .
It use a WMI script and use a Win32_Process to work .
I get all Processes in my Operating System with WMI Query :
"SELECT * from Win32_Process"
so I find all instances with the "ParentProcessId" == at id of your father !
So I know all childs of my Main Process !
And I'll terminated with myProcessChild.Kill();
Hak?