Search code examples
internet-explorerwindows-vistashdocvw

How do I get SHDocVw.InternetExplorer to reuse the same window in Vista like it does in XP?


I am working on a program that uses IE to display its help pages. I am using C# in Visual Studio 2008 compiling to .Net Framework 2.0 In Windows XP everything works as expected. In Vista every time I click on a help button I get a new window with a new IE browser. Has anyone else seen this or know how to get around this?

Here is the code I am using to display a page. strDefault is the location of the html help file I am trying to load. and all of the flags, postData, and Headers are empty. The target Frame is blank because this just loads the main page, I have code after this to load the specific frame. That part of this works fine. It is the Navigate method that is opening a new window in Vista. I have tried using some of the Flag options to no avail.

SHDocVw.InternetExplorer myIE = new SHDocVw.InternetExplorer();
string strDefault = "Frame.htm"
object Flags = new object();
object TargetFrameName = new object();
object PostData = new object();
object Headers = new object();
myIE.Navigate(strDefault, ref Flags, ref TargetFrameName, ref PostData, ref Headers);

Solution

  • Take a look at In-Place Shell Navigation with the WebBrowser Control on Windows 7 from the IEInternals blog. It's not exactly the same issue (or at least I don't think it is!), but hopefully it'll point you towards the right answer.