dwmUpdateThumbnailProperties 函式 (dwmapi.h)

更新桌面視窗管理員 (DWM) 縮圖的屬性。

語法

HRESULT DwmUpdateThumbnailProperties(
       HTHUMBNAIL                     hThumbnailId,
  [in] const DWM_THUMBNAIL_PROPERTIES *ptnProperties
);

參數

hThumbnailId

要更新之 DWM 縮圖的控制碼。 Null 或不正確縮圖,以及其他進程所擁有的縮圖將會導致傳回值E_INVALIDARG。

[in] ptnProperties

包含新縮圖屬性 之DWM_THUMBNAIL_PROPERTIES 結構的指標。

傳回值

如果此函式成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。

備註

在呼叫此函式之前, DwmRegisterThumbnail 函式所建立的縮圖關聯性將不會轉譯至目的地視窗。 後續呼叫會根據提供的屬性來更新縮圖。

範例

下列範例示範如何註冊和顯示桌面縮圖。


HRESULT UpdateDesktop(HWND hwnd)
{
	HRESULT hr = S_OK;

	// Register the thumbnail
	SIZE size = {100,100};
	HTHUMBNAIL thumbnail = NULL;

	hr = DwmRegisterThumbnail(hwnd, FindWindow(_T("Progman"), NULL), &size, &thumbnail);
	if (SUCCEEDED(hr))
	{
		// The destination rectangle size
		RECT dest = {0,50,100,150};

		// Set the thumbnail properties for use
		DWM_THUMBNAIL_PROPERTIES dskThumbProps;
		dskThumbProps.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_VISIBLE | DWM_TNP_SOURCECLIENTAREAONLY;

		// Use the window frame and client area
		dskThumbProps.fSourceClientAreaOnly = FALSE;
		dskThumbProps.fVisible = TRUE;
		dskThumbProps.opacity = (255 * 70)/100;
		dskThumbProps.rcDestination = dest;

		// Display the thumbnail
		hr = DwmUpdateThumbnailProperties(thumbnail,&dskThumbProps);
		if (SUCCEEDED(hr))
		{
			// ...
		}
	}
	return hr;	
}

需求

   
最低支援的用戶端 Windows Vista [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2008 [僅限傳統型應用程式]
目標平台 Windows
標頭 dwmapi.h
程式庫 Dwmapi.lib
Dll Dwmapi.dll

另請參閱

DWM 縮圖概觀

桌面視窗管理員概觀

DwmQueryThumbnailSourceSize

DwmUnregisterThumbnail