pedrito said:
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