System.diagnostics
Hi
Suppose I have 3 iexplore process running. (a,b and c)
I want that my code should identify the âbâ iexplore process and open one url there. (but not in other two iexplore process)
At present I can identify the process but couldnot run the url there so that the page opens in that process window only.
Any help ?
I am using the following code
int i=0,iflag=0,pid=-1; // iflag=0 means no B window is open
Process[] p;
p=Process.GetProcesses();
for (i=0;i<=p.Length-1 ;i++)
{
string s=p[i].ProcessName;
if (p[i].ProcessName =="iexplore")
{
string s2=p[i].MainWindowTitle ;
if (s2=="Google - Microsoft Internet Explorer")
{ iflag=1;
pid=p[i].Id ;
}
}
}
if (iflag==1)
{
ProcessStartInfo ps=new ProcessStartInfo("iexplore.exe");
ps =Process.GetProcessById(pid).StartInfo ;
ps.Arguments ="www.rediff.com";
ps.UseShellExecute=true;
ps.CreateNoWindow =true;
Process.Start(ps);
}
else // if no process B is running it will start the process
{
Process.Start("www.rediff.com");
}
|