DwmEnableComposition function (dwmapi.h)

Enables or disables Desktop Window Manager (DWM) composition.

Note  This function is deprecated as of Windows 8. DWM can no longer be programmatically disabled.
 

Syntax

HRESULT DwmEnableComposition(
  [in] UINT uCompositionAction
);

Parameters

[in] uCompositionAction

DWM_EC_ENABLECOMPOSITION to enable DWM composition; DWM_EC_DISABLECOMPOSITION to disable composition.

Note  As of Windows 8, calling this function with DWM_EC_DISABLECOMPOSITION has no effect. However, the function will still return a success code.
 

Return value

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

Remarks

Disabling DWM composition disables it for the entire desktop. DWM composition will be automatically enabled when all processes that have disabled composition have called DwmEnableComposition to enable it or have been terminated. The WM_DWMCOMPOSITIONCHANGED notification is sent whenever DWM composition is enabled or disabled.

Examples

The following code example disables DWM composition.


...
HRESULT hr = S_OK;

// Disable DWM Composition 
hr = DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
if (SUCCEEDED(hr))
{
   // ...
}
...

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header dwmapi.h
Library Dwmapi.lib
DLL Dwmapi.dll

See also

Enable and Control DWM Composition