1 out of 5 rated this helpful - Rate this topic

DwmIsCompositionEnabled function

Applies to: desktop apps only

Obtains a value that indicates whether Desktop Window Manager (DWM) composition is enabled. Applications can listen for composition state changes by handling the WM_DWMCOMPOSITIONCHANGED notification.

Syntax

HRESULT WINAPI DwmIsCompositionEnabled(
  __out  BOOL *pfEnabled
);

Parameters

pfEnabled [out]

A pointer to a value that, when this function returns successfully, receives TRUE if DWM composition is enabled; otherwise, FALSE.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Dwmapi.h

Library

Dwmapi.lib

DLL

Dwmapi.dll

 

 

Send comments about this topic to Microsoft

Build date: 2/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Sample for C#

// ???? Why does this work at all since it uses an incorrect function signature?

//Alexander Klimoff (http://netsources.narod.ru)

// See also MSDN Magazine April 2007

 

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

 

// Check to see if composition is Enabled
if (DwmIsCompositionEnabled())
{
MessageBox.Show("Aero Glass enabled");
}
else
{
MessageBox.Show("Aero Glass disabled"); 

}

C# example.

[DllImport("dwmapi.dll")]
public static extern IntPtr DwmIsCompositionEnabled(out bool pfEnabled);

bool glassEnabled = false;

if (NativeMethods.DwmIsCompositionEnabled(out glassEnabled) == IntPtr.Zero)
{
MessageBox.Show("Aero Glass is " + (glassEnabled ? "" : "not ") + "Enabled.");
}