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 Version | dwmapi.dll |
|---|
| Header | dwmapi.h |
|---|
| Import library | dwmapi.lib |
|---|
| Minimum operating systems |
Windows Vista |
|---|
See Also
DWM Blur Behind Overview