开发者

How make sure Aero effect is enabled?

开发者 https://www.devze.com 2023-02-13 03:32 出处:网络
Is there any api or something that we make sure, Glass effect is already actived? In some codes that开发者_运维技巧 i saw, if DllNotFoundException throws, then they make sure it\'s not active or not e

Is there any api or something that we make sure, Glass effect is already actived? In some codes that开发者_运维技巧 i saw, if DllNotFoundException throws, then they make sure it's not active or not exists. is there a better or standard way?

This is the solution for Using Aero Effect to extend glass area in WPF.


On this MSDN page it suggests you can detect Glass using DwmIsCompositionEnabled:

When the status of desktop composition is changed, a WM_DWMCOMPOSITIONCHANGED message is broadcast. There are no parameters telling you if it's being enabled or disabled, so it's up to you to call DwmIsCompositionEnabled if you're interested. The code to do the check is straightforward-the tricky part is deciding how you want your window to look if composition is disabled.

[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();

// Check to see if composition is Enabled
if (Environment.OSVersion.Version.Major >= 6 && DwmIsCompositionEnabled())
{
    // enable glass rendering
}
else
{
    // fallback rendering
}

However I'm not sure whether you can "Enable Aero" but "Disable Glass" and if so, what the result of the method would be.

0

精彩评论

暂无评论...
验证码 换一张
取 消