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 / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Invoking System.Diagnostics.Process Start and changing the parent process

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dax - 30 Aug 2007 21:11 GMT
Does anyone know if there's a means by which I can invoke a
Process.Start, then detach the process from the calling process.  I
suppose in a nutshell I'm asking if there's a way I can add the new
process to the "explorer" process.

Thanks!
pedrito - 31 Aug 2007 00:11 GMT
Process.Start spawns a separate process. Every process has its own address
space. Once it's launched, the other process doesn't really have any
connection to the spawned process.

> Does anyone know if there's a means by which I can invoke a
> Process.Start, then detach the process from the calling process.  I
> suppose in a nutshell I'm asking if there's a way I can add the new
> process to the "explorer" process.
>
> Thanks!
Peter Duniho - 31 Aug 2007 02:10 GMT
> Process.Start spawns a separate process. Every process has its own address
> space. Once it's launched, the other process doesn't really have any
> connection to the spawned process.

Well, yes and no.  I don't know the specifics, but Windows does track
which process started which other process.  You can see this if you run
SysInternals Process Explorer, which shows the processes in a
hierarchical display, providing that detail.

I would be very surprised if there was a way to change the parent
process after the fact though.  It seems to me that this is an integral
part of how the process was started, and so once a process is started
the parent is determined permanently for the lifetime of that process.
I'm not even sure if there's a way in .NET to find out the parent
process of a given process, never mind change it.

I do note that via unmanaged code, you can specify the
PROC_THREAD_ATTRIBUTE_THREAD_PARENT_PROCESS attribute when calling
CreateProcess().  So you can't change the parent, but you can explicitly
declare a parent other than the current parent when the process is first
created.

Again, I don't see anything in .NET that would allow this, but if this
is something that would serve the purpose of the OP, going the unmanaged
route might be worthwhile.

Pete

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.