引用Microsoft HTML Object Library
引用 -> com -> Microsoft HTML Object Library
引用后,显示如图
1.判断ie浏览器是否已经打开了指定Url
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows(); bool hasCurrentUrl = false; foreach (SHDocVw.InternetExplorer browser in shellWindows) { if (string.IsNullOrEmpty(browser.FullName)) { continue; } string filename = Path.GetFileNameWithoutExtension(browser.FullName).ToLower(); if (filename.Equals("iexplore") && browser.LocationURL.Contains(webUri)) { hasCurrentUrl = true; break; } }
2.在当前ie进程中添加新tab,打开指定Url
SHDocVw.InternetExplorer webBrowser1 = (SHDocVw.InternetExplorer)shellWindows.Item(shellWindows.Count - 1); webBrowser1.Navigate(webUri);
直接启动新的ie进程,也是可以的 Process.Start("iexplore.exe", “www.baidu.com");
关键字:启动IE浏览器,SHDocVw