public static RestoreWindow ( int hwnd ) : void | ||
hwnd | int | hWnd of window to be restored |
리턴 | void |
public static void open_url(Browser b, bool incognito = false) { var args = new List <string>(); if (!string.IsNullOrEmpty(b.additionalArgs)) { args.Add(b.additionalArgs); } if (incognito) { args.Add(b.private_arg); } if (b.exec.ToLower().EndsWith("brave.exe")) { args.Add("--"); } args.Add(Program.url.Replace("\"", "%22")); if (b.exec.EndsWith("iexplore.exe") && !incognito) { // IE tends to open in a new window instead of a new tab // code borrowed from http://stackoverflow.com/a/3713470/1461004 bool found = false; ShellWindows iExplorerInstances = new ShellWindows(); foreach (InternetExplorer iExplorer in iExplorerInstances) { if (iExplorer.Name.EndsWith("Internet Explorer")) { iExplorer.Navigate(Program.url, 0x800); // for issue #10 (bring IE to focus after opening link) ForegroundAgent.RestoreWindow(iExplorer.HWND); found = true; break; } } if (!found) { Process.Start(b.exec, Program.Args2Str(args)); } } else { ProcessStartInfo startInfo = new ProcessStartInfo(b.exec); // Clicking MS Edge takes more than 4 seconds to load, even with an existing window // Disabling UseShellExecute to create the process directly from the browser executable file startInfo.UseShellExecute = false; startInfo.Arguments = Program.Args2Str(args); Process.Start(startInfo); } Application.Exit(); }
//------------------------------------------------------------------------------------------------------------- public void OpenUrl(BrowserModel browser, bool incognito = false) //------------------------------------------------------------------------------------------------------------- { var args = new List <string>(); if (!string.IsNullOrEmpty(browser.additionalArgs)) { args.Add(browser.additionalArgs); } if (incognito) { args.Add(browser.privateArg); } if (browser.exec.ToLower().EndsWith("brave.exe")) { args.Add("--"); } args.Add(BrowserSelectApp.url.Replace("\"", "%22")); if (browser.exec.EndsWith("iexplore.exe") && !incognito) { // IE tends to open in a new window instead of a new tab // code borrowed from http://stackoverflow.com/a/3713470/1461004 bool found = false; ShellWindows iExplorerInstances = new ShellWindows(); foreach (InternetExplorer iExplorer in iExplorerInstances) { if (iExplorer.Name.EndsWith("Internet Explorer")) { iExplorer.Navigate(BrowserSelectApp.url, 0x800); // for issue #10 (bring IE to focus after opening link) ForegroundAgent.RestoreWindow(iExplorer.HWND); found = true; break; } } if (!found) { Process.Start(browser.exec, args2Str(args)); } } else { Process.Start(browser.exec, args2Str(args)); } Application.Exit(); }
public static void open_url(Browser b, bool incognito = false) { var args = new List <String>(); if (incognito) { args.Add(b.private_arg); } args.Add(Program.url.Replace("\"", "%22")); if (b.exec == "edge") { //edge is a universal app , which means we can't just run it like other browsers Process.Start("microsoft-edge:" + Program.url .Replace(" ", "%20") .Replace("\"", "%22")); } else if (b.exec.EndsWith("iexplore.exe") && !incognito) { // IE tends to open in a new window instead of a new tab // code borrowed from http://stackoverflow.com/a/3713470/1461004 bool found = false; ShellWindows iExplorerInstances = new ShellWindows(); foreach (InternetExplorer iExplorer in iExplorerInstances) { if (iExplorer.Name.EndsWith("Internet Explorer")) { iExplorer.Navigate(Program.url, 0x800); // for issue #10 (bring IE to focus after opening link) ForegroundAgent.RestoreWindow(iExplorer.HWND); found = true; break; } } if (!found) { Process.Start(b.exec, Program.Args2Str(args)); } } else { Process.Start(b.exec, Program.Args2Str(args)); } Application.Exit(); }