DwmExtendFrameIntoClientArea function

Extends the window frame into the client area.

Syntax

DWMAPI DwmExtendFrameIntoClientArea(
  HWND          hWnd,
  const MARGINS *pMarInset
);

Parameters

hWnd

The handle to the window in which the frame will be extended into the client area.

pMarInset

A pointer to a MARGINS structure that describes the margins to use when extending the frame into the client area.

Return Value

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

Remarks

This function must be called whenever Desktop Window Manager (DWM) composition is toggled. Handle the WM_DWMCOMPOSITIONCHANGED message for composition change notification.

Use negative margin values to create the "sheet of glass" effect where the client area is rendered as a solid surface with no window border.

Examples

The following sample demonstrates how to extend the bottom margin, creating a large bottom frame.

C++
HRESULT ExtendIntoClientBottom(HWND hwnd)
{
   // Set margins, extending the bottom margin
   MARGINS margins = {0,0,0,25};
   HRESULT hr = S_OK;

// Extend frame on the bottom of client area hr = DwmExtendFrameIntoClientArea(hwnd,&margins); if (SUCCEEDED(hr)) { // ... } return hr; }

The following sample demonstrates the "sheet of glass" effect where the client area is rendered without a window border.
C++
HRESULT ExtendIntoClientAll(HWND hwnd)
{
   // Negative margins have special meaning to DwmExtendFrameIntoClientArea.
   // Negative margins create the "sheet of glass" effect, where the client area
   // is rendered as a solid surface with no window border.
   MARGINS margins = {-1};
   HRESULT hr = S_OK;

// Extend the frame across the entire window. hr = DwmExtendFrameIntoClientArea(hwnd,&margins); if (SUCCEEDED(hr)) { // ... } return hr; }

Requirements

   
Windows version Windows Vista [desktop apps only] Windows Server 2008 [desktop apps only]
Target Platform Windows
Header dwmapi.h
Library Dwmapi.lib
DLL Dwmapi.dll

See Also

DWM Blur Behind Overview