Last active
August 20, 2016 17:36
-
-
Save billagee/46a1ea83b59f13146567cb779dd003b0 to your computer and use it in GitHub Desktop.
VS 2012 example of using SHDocVw.ShellWindows and SHDocVw.IWebBrowser2 in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using SHDocVw.ShellWindows and SHDocVw.IWebBrowser2 in C# | |
// | |
// VS 2012 edition! | |
// | |
// To do this you must add a reference to the COM component | |
// named "Microsoft Internet Controls" (AKA SHDocVw) | |
using SHDocVw; | |
// ... snip boilerplate code ... | |
SHDocVw.ShellWindows shellWindows = new ShellWindows(); | |
foreach (SHDocVw.IWebBrowser2 ie in shellWindows) | |
{ | |
Console.WriteLine("ie.LocationURL: " + ie.LocationURL); | |
if (ie.LocationURL.Contains("foo.com")) | |
ie.Quit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment