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; } }