public enum WindowsPeekAtDesktop { Enabled = 1, Disabled = 0, } [DllImport("dwmapi.dll", PreserveSig = false)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool DwmIsCompositionEnabled(); public static WindowsPeekAtDesktop IsPeekAtDesktop() { // Tried using RegistryKey //RegistryKey AeroPeek = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\DWM", true); //var abc = AeroPeek.GetValue("EnableAeroPeek"); //var aa = DwmWindowAttribute.DWMWA_EXCLUDED_FROM_PEEK; if (Environment.OSVersion.Version.Major >= 6 && DwmIsCompositionEnabled()) return WindowsPeekAtDesktop.Enabled; return WindowsPeekAtDesktop.Disabled; }
//Peek at desktop [DllImport("dwmapi.dll")] public static extern int DwmIsCompositionEnabled(out bool enabled); public static bool AeroEnabled() { if (Environment.OSVersion.Version.Major < 6) return false; bool result; DwmIsCompositionEnabled(out result); return result; } public static WindowsPeekAtDesktop IsPeekAtDesktop() { return AeroEnabled() ? WindowsPeekAtDesktop.Enable : WindowsPeekAtDesktop.Disable; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)