Example #1
0
        public static void BlurWindow(System.Windows.Window window)
        {
            var winhelp = new WindowInteropHelper(window);

            ACCENTPOLICY policy_Blur = new ACCENTPOLICY();

            policy_Blur.nAccentState = ACCENT_ENABLE_BLURBEHIND;
            policy_Blur.nFlags       = 0;
            policy_Blur.nColor       = 0;
            policy_Blur.nAnimationId = 0;

            WINCOMPATTRDATA wINCOMPATTRDATA = new WINCOMPATTRDATA();

            wINCOMPATTRDATA.nAttribute = WCA_ACCENT_POLICY;
            IntPtr pData = Marshal.AllocHGlobal(Marshal.SizeOf(policy_Blur));

            Marshal.StructureToPtr(policy_Blur, pData, false);
            wINCOMPATTRDATA.pData      = pData;
            wINCOMPATTRDATA.ulDataSize = Marshal.SizeOf(policy_Blur);

            SetWindowCompositionAttribute(winhelp.Handle, ref wINCOMPATTRDATA);

            Marshal.FreeHGlobal(pData);
        }
Example #2
0
 public static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WINCOMPATTRDATA data);