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 t开发者_JS百科his 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);
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.
There are fundamental changes in how IE works with the OS from Vista, includng the fact that new browser requests happen in new processes instead of the same process. Also, are you using IE8? If so, each tab runs in it's own process within the same window.
精彩评论