IWebBrowser2.Navigate opens second window

Posted by Sam Barham on Stack Overflow See other posts from Stack Overflow or by Sam Barham
Published on 2009-07-29T22:35:00Z Indexed on 2010/04/21 4:03 UTC
Read the original article Hit count: 590

Filed under:
|
|

The following code, on Vista with Internet Explorer 7, opens two windows (the one I create, and then a second one when Navigate is called, which is the one that the file appears in). This doesn't happen in Internet Explorer 8, or on XP as far as I know. Any idea how I can stop it doing that?

     SHDocVw.InternetExplorerClass ieObject = (SHDocVw.InternetExplorerClass)this.ieObject;
     if (this.ieObject == null)
     {
        ieObject = new SHDocVw.InternetExplorerClass();
        this.ieObject = ieObject;
     }

     SHDocVw.IWebBrowser2 browserApp = (SHDocVw.IWebBrowser2)this.ieObject;
     object empty = System.Reflection.Missing.Value;
     browserApp.Visible = true;
     User32.SetForegroundWindow(new IntPtr(browserApp.HWND));
     browserApp.Navigate(filePath, ref empty, ref empty, ref empty, ref empty);

© Stack Overflow or respective owner

Related posts about Vista

Related posts about ie7