次のコードは、Internet Explorer 7を搭載したVistaで、2つのウィンドウを開きます(私が作成したウィンドウと、Navigateが呼び出されたときの2番目のウィンドウ(ファイルが表示されるウィンドウ))。私の知る限り、これはInternetExplorer8やXPでは発生しません。どうすればそれをやめることができますか?
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);