DwmExtendFrameIntoClientArea 函式 (dwmapi.h)

將視窗框架延伸至工作區。

語法

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

參數

[in] 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
程式庫 Dwmapi.lib
Dll Dwmapi.dll

另請參閱

DWM 模糊後置概觀