Esempio n. 1
0
        private static bool EnumWindowsCallback(IntPtr hWnd, IntPtr lParam)
        {
            bool specialCapturing = false;

            if (hWnd == IntPtr.Zero)
            {
                return(false);
            }
            if (!WindowSnap.IsWindowVisible(hWnd))
            {
                return(true);
            }
            if (!WindowSnap.countMinimizedWindows)
            {
                if (WindowSnap.IsIconic(hWnd))
                {
                    return(true);
                }
            }
            else if (WindowSnap.IsIconic(hWnd) && WindowSnap.useSpecialCapturing)
            {
                specialCapturing = true;
            }
            if (WindowSnap.GetWindowText(hWnd) == "Program Manager")
            {
                return(true);
            }
            WindowSnap.windowSnaps.Add(new WindowSnap(hWnd, specialCapturing));
            return(true);
        }
Esempio n. 2
0
 private static bool NeedSpecialCapturing(IntPtr hWnd)
 {
     if (WindowSnap.IsIconic(hWnd))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
        private WindowSnap(IntPtr hWnd, bool specialCapturing)
        {
            this.isIconic = WindowSnap.IsIconic(hWnd);
            this.hWnd     = hWnd;
            if (specialCapturing)
            {
                WindowSnap.EnterSpecialCapturing(hWnd);
            }
            WindowSnap.WINDOWINFO wINDOWINFO = new WindowSnap.WINDOWINFO()
            {
                cbSize = WindowSnap.WINDOWINFO.GetSize()
            };
            WindowSnap.GetWindowInfo(hWnd, ref wINDOWINFO);
            bool      flag            = false;
            IntPtr    parent          = WindowSnap.GetParent(hWnd);
            Rectangle windowPlacement = new Rectangle();
            Rectangle rectangle       = new Rectangle();

            if (WindowSnap.forceMDI && parent != IntPtr.Zero && (wINDOWINFO.dwExStyle & WindowSnap.ExtendedWindowStyles.WS_EX_MDICHILD) == WindowSnap.ExtendedWindowStyles.WS_EX_MDICHILD)
            {
                StringBuilder stringBuilder = new StringBuilder();
                WindowSnap.GetClassName(parent, stringBuilder, "RunDLL".Length + 1);
                if (stringBuilder.ToString() != "RunDLL")
                {
                    flag            = true;
                    windowPlacement = WindowSnap.GetWindowPlacement(hWnd);
                    WindowSnap.MoveWindow(hWnd, 2147483647, 2147483647, windowPlacement.Width, windowPlacement.Height, true);
                    WindowSnap.SetParent(hWnd, IntPtr.Zero);
                    rectangle = WindowSnap.GetWindowPlacement(parent);
                }
            }
            Rectangle windowPlacement1 = WindowSnap.GetWindowPlacement(hWnd);

            this.size     = windowPlacement1.Size;
            this.location = windowPlacement1.Location;
            this.text     = WindowSnap.GetWindowText(hWnd);
            this.image    = WindowSnap.GetWindowImage(hWnd, this.size);
            if (flag)
            {
                WindowSnap.SetParent(hWnd, parent);
                int left = wINDOWINFO.rcWindow.Left - rectangle.X;
                int top  = wINDOWINFO.rcWindow.Top - rectangle.Y;
                if ((wINDOWINFO.dwStyle & WindowSnap.WindowStyles.WS_THICKFRAME) == WindowSnap.WindowStyles.WS_THICKFRAME)
                {
                    left -= 100; //SystemInformation.Border3DSize.Width;

                    top -= 100;  //SystemInformation.Border3DSize.Height;
                }
                WindowSnap.MoveWindow(hWnd, left, top, windowPlacement.Width, windowPlacement.Height, true);
            }
            if (specialCapturing)
            {
                WindowSnap.ExitSpecialCapturing(hWnd);
            }
        }
Esempio n. 4
0
 private static bool NeedSpecialCapturing(IntPtr hWnd)
 {
     return(WindowSnap.IsIconic(hWnd));
 }