110,571
社区成员
发帖
与我相关
我的任务
分享
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
bool isExist = false;
foreach (SHDocVw.InternetExplorer ie in shellWindows)
{
// 判斷視窗是否為 iexplore
if (Path.GetFileNameWithoutExtension(ie.FullName).ToLower().Equals("iexplore"))
{
mshtml.HTMLDocument hd = ie.Document as mshtml.HTMLDocument;
if (ie.LocationURL == "http://www.baidu.com/")
{
isExist = true;
}
}
}
if (!isExist)
{
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "iexplore.exe";
myProcess.StartInfo.Arguments = "http://www.baidu.com/";
myProcess.Start();
}