private void BringIEToFront() { if (this.currentIEHandle != IntPtr.Zero) { if (IEHelper.IsIconic(this.currentIEHandle)) { IEHelper.ShowWindow(this.currentIEHandle, 9); return; } IEHelper.LockSetForegroundWindow(2U); IEHelper.BringWindowToTop(this.currentIEHandle); IEHelper.SetForegroundWindow(this.currentIEHandle); } }
private bool FindIEByHandle() { bool result = false; if (this.helpProcess != null && !this.helpProcess.HasExited) { this.helpProcess.Refresh(); this.currentIEHandle = this.helpProcess.MainWindowHandle; } if (IEHelper.IsWindow(this.currentIEHandle)) { try { IEnumerable enumerable = (IEnumerable) new IEHelper.ShellWindowsClass(); foreach (object obj in enumerable) { IEHelper.IWebBrowser2 webBrowser = obj as IEHelper.IWebBrowser2; if (webBrowser != null && this.currentIEHandle == (IntPtr)webBrowser.HWND) { result = true; this.ie = webBrowser; break; } } } catch (COMException) { } catch (InvalidComObjectException) { } catch (TargetException) { } catch (FileNotFoundException) { } } return(result); }