public static bool IsAltTabWindow(IntPtr hwnd) { const uint WS_EX_TOOLWINDOW = 0x00000080; const uint DWMWA_CLOAKED = 14; if (!WinApiManager.IsWindowVisible(hwnd)) { return(false); } string title = GetWindowTitle(hwnd); if (title == null || title == "Menu" || title == "GestureWindow" || title == "BlockingWindow" || title == "AppList") { return(false); } WinApiManager.WINDOWINFO winInfo = new WinApiManager.WINDOWINFO(true); WinApiManager.GetWindowInfo(hwnd, ref winInfo); if ((winInfo.dwExStyle & WS_EX_TOOLWINDOW) != 0) { return(false); } uint CloakedVal; WinApiManager.DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, out CloakedVal, sizeof(uint)); return(CloakedVal == 0); }
private static IntPtr GetLastVisibleActivePopUpOfWindow(IntPtr window) { IntPtr lastPopUp = WinApiManager.GetLastActivePopup(window); if (WinApiManager.IsWindowVisible(lastPopUp)) { return(lastPopUp); } else if (lastPopUp == window) { return(IntPtr.Zero); } else { return(GetLastVisibleActivePopUpOfWindow(lastPopUp)); } }