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

This is a discussion on Invoking System.Diagnostics.Process Start and changing the parent process - CSharp ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

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

  1. Default Invoking System.Diagnostics.Process Start and changing the parent 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!


  2. Default Re: Invoking System.Diagnostics.Process Start and changing the parent process

    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.


    "Dax" <daxmw@comcast.net> wrote in message
    news:1188504709.429011.93560@x40g2000prg.googlegroups.com...
    > 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!
    >




  3. Default Re: Invoking System.Diagnostics.Process Start and changing the parentprocess

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

+ Reply to Thread

Similar Threads

  1. System.Diagnostics.Process() hangs
    By Application Development in forum DOTNET
    Replies: 5
    Last Post: 11-13-2007, 07:20 AM
  2. System.Diagnostics.Process.Start async callback?
    By Application Development in forum CSharp
    Replies: 2
    Last Post: 09-04-2007, 11:32 AM
  3. Replies: 1
    Last Post: 04-17-2006, 04:11 PM
  4. System.Diagnostics.Process.Start fails on windows server 2003
    By Application Development in forum XML SOAP
    Replies: 0
    Last Post: 04-12-2006, 02:33 PM