I start a process in c# like this:
Process p= new Process();
p.StartInfo.FileName = "iexplore.exe";
p.StartInfo.Arguments = "about:blank";
p.Start();
Sometimes I already have an instance of Internet Explorer running (something I cannot control), and when I try to grab the MainWindowHandle of p:
p.MainWindowHandle
I get an exception, saying the process has already exited.
I am trying to get the MainwindowHandle so I can attach it to an InternetExplorer object.
How can I accomplish this with multiple instances of IE running?