Skip to content

Instantly share code, notes, and snippets.

@riverar
Last active December 10, 2022 08:08
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save riverar/fd6525579d6bbafc6e48 to your computer and use it in GitHub Desktop.
Save riverar/fd6525579d6bbafc6e48 to your computer and use it in GitHub Desktop.
C# structures to implement "Aero Glass" blur on Windows 10
[DllImport("user32.dll")]
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
internal enum WindowCompositionAttribute
{
// ...
WCA_ACCENT_POLICY = 19
// ...
}
internal enum AccentState
{
ACCENT_DISABLED = 0,
ACCENT_ENABLE_GRADIENT = 1,
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
ACCENT_ENABLE_BLURBEHIND = 3,
ACCENT_INVALID_STATE = 4
}
[StructLayout(LayoutKind.Sequential)]
internal struct AccentPolicy
{
public AccentState AccentState;
public int AccentFlags;
public int GradientColor;
public int AnimationId;
}
@bryson11
Copy link

How to use it ?

@rikka0w0
Copy link

rikka0w0 commented May 8, 2018

My example here, in Chinese but the code itself should be self-explanatory
https://www.kechuang.org/t/79675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment