private void systemProcessHook_WindowEvent(object sender, IntPtr handle, Interop.ShellEvents shell) { if (shell == Interop.ShellEvents.HSHELL_WINDOWDESTROYED) { if (altTabList.Remove(handle)) { Console.WriteLine("hwnd:{0}, title:{1} removed. altTabList cound ={2}", handle.ToString(), WowDisableWinKeyTools.GetWindowTitle(handle), altTabList.Count.ToString()); } } if (shell == Interop.ShellEvents.HSHELL_WINDOWCREATED && OpenWindowGetter.KeepWindowHandleInAltTabList(handle)) { altTabList.Insert(0, handle); Console.WriteLine("hwnd:{0}, title:{1} inserted. altTabList cound ={2}", handle.ToString(), WowDisableWinKeyTools.GetWindowTitle(handle), altTabList.Count.ToString()); tabOrWindow = SwitchTo.Window; } }
private void HookManager_ForegroundChanged(object sender, EventArgs e) { bool newWindow = true; IntPtr fore = (IntPtr)sender; try { // try to find new foreground window in alt tab list foreach (IntPtr hWnd in altTabList) { if (hWnd == fore) { newWindow = false; break; } } //Thread.Sleep(10); //if (newWindow && OpenWindowGetter.KeepWindowHandleInAltTabList(fore)) //{ // altTabList.Insert(0, fore); // Console.WriteLine(WowDisableWinKeyTools.GetWindowTitle(fore) + " " + fore.ToString()); //} if (!newWindow) { IntPtr windowHWnd = altTabList.Find(x => x == fore); if (windowHWnd != IntPtr.Zero) { altTabList.Remove(windowHWnd); altTabList.Insert(0, windowHWnd); tabOrWindow = SwitchTo.Window; } } //check if window exists, remove from list if not } catch { } }
public ActionItemSwitchEventArgs(SwitchTo switchTo) { this.SwitchTo = switchTo; }
public static void SwitchToLastWindow() { SwitchTo.Window(Driver.WindowHandles.Last()); }
public static void SwitchToDefaultWindow() { SwitchTo.Window(Driver.WindowHandles.First()); }
public static void SwitchToPrevious() { SwitchTo.ParentFrame(); }
public static void SwitchToIframe(IWebElement iframe) { SwitchTo.Frame(iframe); }