Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2004

Tip: Looking for answers? Try searching our database.

Process.Start() and Childs Process

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hak?na k? - 31 May 2004 13:30 GMT
Hello Everybody ,
I have a Process.Start() method that launch a "main.exe" files .

The "main.exe" launch 3 sub-file :
a.exe
b.exe
c.exe

What I want is the When I close the Main.exe , then the sub-file exe must
Close !

Basically is the same as "terminate childs processes..." of TaskManager :
it close All processes generated by a "process" .

Any help ?

Hak?na k?
Niki Estner - 31 May 2004 14:14 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.