DwmExtendFrameIntoClientArea Function

Extends the window frame behind the client area.

Syntax

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

Parameters

hWnd
The handle to the window for which the frame is extended into the client area.
pMarInset
[in] The pointer to a MARGINS Structure structure that describes the margins to use when extending the frame into the client area.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

If Desktop Window Manager (DWM) composition is toggled, this function must be called again. Handle the WM_DWMCOMPOSITIONCHANGED message for composition change notification.

Negative margins are used 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 demonstates how to extend the bottom margin, creating a large bottom frame.

HRESULT ExtendIntoClientBottom(HWND hwnd)
{
   //Set margins, extend bottom
   MARGINS margins = {0,0,0,25};
   HRESULT hr = S_OK;

   //extend frame on bottom of client area
   hr = DwmExtendFrameIntoClientArea(hwnd,&margins);
   if (SUCCEEDED(hr))
   {
      //do more things
   }
   return hr;
}

The following sample demonstrates the "sheet of glass" effect where the client area is rendered without a window border.

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 frame across entire window.
   hr = DwmExtendFrameIntoClientArea(hwnd,&margins);
   if (SUCCEEDED(hr))
   {
      //do more things
   }
   return hr;
}

Function Information

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

See Also

DWM Blur Behind Overview
Tags :


Community Content

dmex
vb.net syntax
<DllImport("dwmapi.dll")> _
Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarInset As Margin) As Integer
End Function
Tags : vb.net syntax

dmex
C# syntax
[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margin pMarInset);
Tags : c# syntax

Page view tracker