示例#1
0
        public bool IsAltTabWindow(IntPtr window, string windowTitle)
        {
            if (windowTitle == "Jump List")
            {
                return(false);
            }

            if (windowTitle == "TaskListThumbnailWnd")
            {
                return(false);
            }

            if (windowTitle == "Unity Personal (64bit) - yams.unity - Floating Windows - PC, Mac & Linux Standalone <DX11>" || windowTitle == "Multiscreens" || windowTitle == "UnityContainerWndClass")
            {
                return(true);
            }

            //if (windowTitle ==
            if (window == taskbarHandle)
            {
                return(true);
            }
            //if (window == Win32funcs.GetShellWindow())   //Desktop
            //	return false;

            //http://stackoverflow.com/questions/210504/enumerate-windows-like-alt-tab-does
            //http://blogs.msdn.com/oldnewthing/archive/2007/10/08/5351207.aspx
            //1. For each visible window, walk up its owner chain until you find the root owner.
            //2. Then walk back down the visible last active popup chain until you find a visible window.
            //3. If you're back to where you're started, (look for exceptions) then put the window in the Alt+Tab list.
            IntPtr root = Win32Funcs.GetAncestor(window, Win32Consts.GetAncestorFlags.GetRootOwner);

            if (GetLastVisibleActivePopUpOfWindow(root) == window)
            {
                Win32Types.WindowInfo wi = new Win32Types.WindowInfo(window);

                if (wi.className == "#32768" ||
                    wi.className == "Shell_TrayWnd" ||                   //Windows taskbar
                    wi.className == "DV2ControlHost" ||                  //Windows startmenu, if open
                    (wi.className == "Button" && wi.title == "Start") || //Windows startmenu-button.
                    wi.className == "MsgrIMEWindowClass" ||              //Live messenger's notifybox i think
                    wi.className == "SysShadow" ||                       //Live messenger's shadow-hack
                    wi.className.StartsWith("WMP9MediaBarFlyout"))       //WMP's "now playing" taskbar-toolbar
                {
                    return(false);
                }

                return(true);
            }
            return(false);
        }
示例#2
0
        public WindowCapture(IntPtr windowHandle, bool isDesktop, bool onlyCaptureMouse = false)
        {
            this.isDesktop = isDesktop;

            this.onlyCaptureMouse = onlyCaptureMouse;

            // windowHandle is your window handle, IntPtr.Zero is the desktop
            hwnd       = windowHandle;
            windowInfo = new Win32Types.WindowInfo(hwnd);

            SetupWindowCapture();

            bitmapBytes = null;
        }