1 private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) 2 { 3 try 4 { 5 foreach (var item in lis_url) 6 { 7 if (e.Url.ToString().StartsWith(item)) 8 { 9 var p = Process.Start("iexplore.exe", e.Url.ToString()); 10 if (p.Start()) 11 SetForegroundWindow(p.MainWindowHandle); 12 e.Cancel = true; 13 break; 14 } 15 } 16 } 17 catch (Exception ex) 18 { 19 } 20 } 21 [DllImport("USER32.DLL")] 22 public static extern bool SetForegroundWindow(IntPtr hWnd);