DwmSetWindowAttribute function (dwmapi.h)

Sets the value of Desktop Window Manager (DWM) non-client rendering attributes for a window. For programming guidance, and code examples, see Controlling non-client region rendering.

Syntax

HRESULT DwmSetWindowAttribute(
  [in] HWND    hwnd,
  [in] DWORD   dwAttribute,
  [in] LPCVOID pvAttribute,
  [in] DWORD   cbAttribute
);

Parameters

[in] hwnd

The handle to the window for which the attribute value is to be set.

[in] dwAttribute

A flag describing which value to set, specified as a value of the DWMWINDOWATTRIBUTE enumeration. This parameter specifies which attribute to set, and the pvAttribute parameter points to an object containing the attribute value.

[in] pvAttribute

A pointer to an object containing the attribute value to set. The type of the value set depends on the value of the dwAttribute parameter. The DWMWINDOWATTRIBUTE enumeration topic indicates, in the row for each flag, what type of value you should pass a pointer to in the pvAttribute parameter.

[in] cbAttribute

The size, in bytes, of the attribute value being set via the pvAttribute parameter. The type of the value set, and therefore its size in bytes, depends on the value of the dwAttribute parameter.

Return value

Type: HRESULT

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

If Desktop Composition has been disabled (Windows 7 and earlier), then this function returns DWM_E_COMPOSITIONDISABLED.

Remarks

It's not valid to call this function with the dwAttribute parameter set to DWMWA_NCRENDERING_ENABLED. To enable or disable non-client rendering, you should use the DWMWA_NCRENDERING_POLICY attribute, and set the desired value. For more info, and a code example, see Controlling non-client region rendering.

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; Uxtheme.dll

See also