DwmExtendFrameIntoClientArea 函数 (dwmapi.h)

将窗口框架扩展到工作区。

语法

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

参数

hWnd

框架将扩展到工作区的窗口的句柄。

[in] pMarInset

指向 MARGINS 结构的指针,该结构描述在将帧扩展到工作区时要使用的边距。

返回值

如果此函数成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。

注解

每当切换桌面窗口管理器 (DWM) 组合时,都必须调用此函数。 处理组合更改通知 WM_DWMCOMPOSITIONCHANGED 消息。

使用负边距值创建“玻璃片”效果,其中工作区呈现为无窗口边框的实心表面。

示例

以下示例演示如何扩展下边距,创建一个大底框。


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;
}

以下示例演示了“玻璃片”效果,其中工作区在没有窗口边框的情况下呈现。


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;
}

要求

要求
最低受支持的客户端 Windows Vista [仅限桌面应用]
最低受支持的服务器 Windows Server 2008 [仅限桌面应用]
目标平台 Windows
标头 dwmapi.h
Library Dwmapi.lib
DLL Dwmapi.dll

另请参阅

DWM 模糊背后的概述