private Image GetDesktopBitmap(IntPtr hWnd, User32.RECT rect)
 {
     var crect = new User32.RECT(rect.Left, rect.Top, rect.Right, rect.Bottom);
     var p = new User32.POINT(0, 0);
     User32.ClientToScreen(hWnd, ref p);
     crect.Top = p.Y;
     crect.Left = p.X;
     crect.Bottom = p.Y + crect.Bottom;
     crect.Right = p.X + crect.Right;
     if (VisibilityTester.HitTest(crect, hWnd, new[] { new Point(p.X + 1, p.Y + 1) }, IntPtr.Zero))
     {
         return GetDesktopBitmap(hWnd);
     }
     return null;
 }
Esempio n. 2
0
 public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, User32.SetWindowPostFlags wFlags);
Esempio n. 3
0
 public static extern bool GetClientRect(IntPtr hWnd, ref User32.RECT lpRect);
Esempio n. 4
0
 public static extern bool GetWindowRect(IntPtr hWnd, ref User32.RECT lpRect);
Esempio n. 5
0
 /// <summary>
 ///     Activates (bring foreground) the given window.
 /// </summary>
 /// <param name="winHandle">A handle to the window</param>
 /// <param name="sizeFlag">How the window should be shown if minimized</param>
 static private void activate(IntPtr winHandle, User32.ShowState sizeFlag)
 {
     switch (sizeFlag) {
     case User32.ShowState.Restore:
         if (isMiniMized(winHandle))
             User32.ShowWindow(winHandle, User32.ShowState.Normal);
         User32.SetForeground(winHandle);
         break;
     case User32.ShowState.Maximize:
         if (isMiniMized(winHandle))
             User32.ShowWindow(winHandle, User32.ShowState.ShowMaximized);
         User32.SetForeground(winHandle);
         break;
     default:
         User32.ShowWindow(winHandle, sizeFlag);
         User32.SetForeground(winHandle);
         break;
     }
 }
Esempio n. 6
0
 public Monitor(IntPtr handle, User32.MonitorInfo info)
 {
     MonitorHandle = handle;
     MonitorInfo = info;
 }