Home > Software design >  Can anyone help me to get handle of process which is called by func Process.Start();?
Can anyone help me to get handle of process which is called by func Process.Start();?

Time:12-04

For example, I wanna get handle from browser.

 private void button1_Click(object sender, EventArgs e)
        {
            Process.Start("https://google.com/");
            //How to get handle of this process?
            
        }

CodePudding user response:

Process.Start() returns a Process object of the newly created process.

In the example below, myProcess.Handle is going to be the handle of said process.

var myProcess = Process.Start("notepad.exe");
Console.WriteLine(myProcess.Handle);
  • Related