Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Reference
Functions
 DwmSetWindowAttribute Function
DwmSetWindowAttribute Function

Sets the value of the specified attributes for non-client rendering to apply to the window.

Syntax

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

Parameters

hwnd
[in] The window handle to apply the given attribute.
dwAttribute
[in] The DWMWINDOWATTRIBUTE to apply to the window.
pvAttribute
[in] The pointer to the DWMWINDOWATTRIBUTE value to apply. The type of item pointed to is dependent on the value of the dwAttribute parameter.
cbAttribute
[in] The size, in bytes, of the DWMWINDOWATTRIBUTE value being set. The size is dependent on the type of the pvAttribute parameter.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Calling this function with dwAttribute set to DWMWA_NCRENDERING_ENABLED does not set the attribute. DWMWA_NCRENDERING_ENABLED is a "get" attribute and the resulting call is equivalent to a DwmGetWindowAttribute call. To enable or disable non-client rendering, the DWMWA_NCRENDERING_POLICY attribute must to set to the desired value.

Example

The following example disables non-client area rendering, causing any previous calls to DwmEnableBlurBehindWindow or DwmExtendFrameIntoClientArea to be disabled.

HRESULT DisableNCRendering(HWND hwnd)
{
   HRESULT hr = S_OK;
   DWMNCRENDERINGPOLICY ncrp = DWMNCRP_DISABLED;

   // Disable non-client area rendering on the window.
   hr = DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &ncrp, sizeof(ncrp));
   if (SUCCEEDED(hr))
   {
      // Do work here. 
   }
 
   return hr;
}

Function Information

Minimum DLL Versiondwmapi.dll
Headerdwmapi.h
Import librarydwmapi.lib
Minimum operating systems Windows Vista

See Also

Enable and Control DWM Composition
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker