Exemplo n.º 1
0
        public static Size GetNonClientArea(IntPtr hwnd)
        {
            var c = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);

            UnsafeNativeMethods.ClientToScreen(hwnd, ref c);
            var r = new RECT();

            UnsafeNativeMethods.GetWindowRect(hwnd, ref r);

            return(new Size(c.X - r.left, c.Y - r.top));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the specified peek (live preview) bitmap for the specified
        /// window.  This is typically done in response to a DWM message.
        /// </summary>
        /// <param name="hwnd">The window handle.</param>
        /// <param name="bitmap">The thumbnail bitmap.</param>
        /// <param name="offset">The client area offset at which to display
        /// the specified bitmap.  The rest of the parent window will be
        /// displayed as "remembered" by the DWM.</param>
        /// <param name="displayFrame">Whether to display a standard window
        /// frame around the bitmap.</param>
        public static void SetPeekBitmap(IntPtr hwnd, Bitmap bitmap, Point offset, bool displayFrame)
        {
            var nativePoint = new VistaBridgeInterop.SafeNativeMethods.POINT(offset.X, offset.Y);
            int rc          = UnsafeNativeMethods.DwmSetIconicLivePreviewBitmap(
                hwnd,
                bitmap.GetHbitmap(),
                ref nativePoint,
                displayFrame ? SafeNativeMethods.DWM_SIT_DISPLAYFRAME : (uint)0);

            if (rc != 0)
            {
                throw Marshal.GetExceptionForHR(rc);
            }
        }
Exemplo n.º 3
0
        public static Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent)
        {
            var childScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);

            UnsafeNativeMethods.ClientToScreen(
                hwnd, ref childScreenCoord);
            var parentScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);

            UnsafeNativeMethods.ClientToScreen(
                hwndParent, ref parentScreenCoord);
            Point offset = new Point(
                childScreenCoord.X - parentScreenCoord.X,
                childScreenCoord.Y - parentScreenCoord.Y);

            return(offset);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the specified peek (live preview) bitmap for the specified
 /// window.  This is typically done in response to a DWM message.
 /// </summary>
 /// <param name="hwnd">The window handle.</param>
 /// <param name="bitmap">The thumbnail bitmap.</param>
 /// <param name="offset">The client area offset at which to display
 /// the specified bitmap.  The rest of the parent window will be
 /// displayed as "remembered" by the DWM.</param>
 /// <param name="displayFrame">Whether to display a standard window
 /// frame around the bitmap.</param>
 public static void SetPeekBitmap(IntPtr hwnd, Bitmap bitmap, Point offset, bool displayFrame)
 {
     var nativePoint = new VistaBridgeInterop.SafeNativeMethods.POINT(offset.X, offset.Y);
     int rc = UnsafeNativeMethods.DwmSetIconicLivePreviewBitmap(
         hwnd,
         bitmap.GetHbitmap(),
         ref nativePoint,
         displayFrame ? SafeNativeMethods.DWM_SIT_DISPLAYFRAME : (uint)0);
     if (rc != 0)
         throw Marshal.GetExceptionForHR(rc);
 }
Exemplo n.º 5
0
        public static Size GetNonClientArea(IntPtr hwnd)
        {
            var c = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);
            UnsafeNativeMethods.ClientToScreen(hwnd, ref c);
            var r = new RECT();
            UnsafeNativeMethods.GetWindowRect(hwnd, ref r);

            return new Size(c.X - r.left, c.Y - r.top);
        }
Exemplo n.º 6
0
 public static Point GetParentOffsetOfChild(IntPtr hwnd, IntPtr hwndParent)
 {
     var childScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);
     UnsafeNativeMethods.ClientToScreen(
         hwnd, ref childScreenCoord);
     var parentScreenCoord = new VistaBridgeInterop.SafeNativeMethods.POINT(0, 0);
     UnsafeNativeMethods.ClientToScreen(
         hwndParent, ref parentScreenCoord);
     Point offset = new Point(
         childScreenCoord.X - parentScreenCoord.X,
         childScreenCoord.Y - parentScreenCoord.Y);
     return offset;
 }
Exemplo n.º 7
0
Arquivo: Interop.cs Projeto: bo3b/iZ3D
 public static extern bool ClientToScreen(
     IntPtr hwnd,
     ref VistaBridgeInterop.SafeNativeMethods.POINT point);
Exemplo n.º 8
0
Arquivo: Interop.cs Projeto: bo3b/iZ3D
 public static extern int DwmSetIconicLivePreviewBitmap(
     IntPtr hwnd,
     IntPtr hbitmap,
     ref VistaBridgeInterop.SafeNativeMethods.POINT ptClient,
     uint flags);