Get a PID of a process before the process can do anything

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I need to create a new child process and save the process ID to a database, and I need to make sure the PID is saved before the child process can perform any action. Is it possible to either create a suspended process or to get a process ID before
calling Start()?
Code:
             proc = new System.Diagnostics.Process();<br/>
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("notepad");<br/>
            proc.StartInfo = psi;<br/>
            int id = proc.Id;<br/>
            textBox1.AppendText("The process id is: " + id.ToString()); 
             proc.Start();

Thanks,
JAF


View the full article
 
Back
Top