Ejemplo n.º 1
0
        /// <summary>
        /// Sets whether Aero Peek is enabled or disabled on a window.
        /// </summary>
        /// <param name="hwnd">Handle of the window whose Aero Peek state should be altered.</param>
        /// <param name="disallowPeek">True if Aero Peek should be disabled for the window. False otherwise.</param>
        /// <remarks>Is ignored on OSs that do not support Aero Peek.</remarks>
        public static void SetDisallowPeek(IntPtr hwnd, bool disallowPeek)
        {
            if (!OsSupport.IsSevenOrLater || !OsSupport.IsCompositionEnabled)
            {
                return;
            }

            if (DwmMethods.DwmSetWindowDisallowPeek(hwnd, disallowPeek) != 0)
            {
                throw new Exception(ExceptionMessages.DwmDisallowPeekFail);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets whether Aero Peek is enabled or disabled on a window.
        /// </summary>
        /// <param name="form">Form whose Aero Peek state should be altered.</param>
        /// <param name="disallowPeek">True if Aero Peek should be disabled for the window. False otherwise.</param>
        /// <remarks>Is ignored on OSs that do not support Aero Peek.</remarks>
        public static void SetDisallowPeek(Form form, bool disallowPeek)
        {
            if (!OsSupport.IsSevenOrBetter || !OsSupport.IsCompositionEnabled)
            {
                return;
            }

            if (DwmMethods.DwmSetWindowDisallowPeek(form.Handle, disallowPeek) != 0)
            {
                throw new Exception(ExceptionMessages.DwmDisallowPeekFail);
            }
        }