DwmRegisterThumbnail function (dwmapi.h)
Creates a Desktop Window Manager (DWM) thumbnail relationship between the destination and source windows.
Syntax
HRESULT DwmRegisterThumbnail(
[in] HWND hwndDestination,
[in] HWND hwndSource,
[out] PHTHUMBNAIL phThumbnailId
);
Parameters
[in] hwndDestination
The handle to the window that will use the DWM thumbnail. Setting the destination window handle to anything other than a top-level window type will result in a return value of E_INVALIDARG.
[in] hwndSource
The handle to the window to use as the thumbnail source. Setting the source window handle to anything other than a top-level window type will result in a return value of E_INVALIDARG.
[out] phThumbnailId
A pointer to a handle that, when this function returns successfully, represents the registration of the DWM thumbnail.
Return value
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
Registering a DWM thumbnail relationship will not modify desktop composition; for information about thumbnail positioning, see the documentation for the DwmUpdateThumbnailProperties function.
The window designated by hwndDestination must either be the desktop window itself or be owned by the process that is calling DwmRegisterThumbnail. This is required to prevent applications from affecting the content of other applications.
The thumbnail registration handle obtained by this function is not globally unique but is unique to the process. Call the DwmUnregisterThumbnail function to unregister the thumbnail. This must be done within the process that the relationship was registered in.
Examples
The following example demonstrates how to register the desktop thumbnail.
HRESULT UpdateDesktop(HWND hwnd)
{
HRESULT hr = S_OK;
// Register the thumbnail
HTHUMBNAIL thumbnail = NULL;
hr = DwmRegisterThumbnail(hwnd, FindWindow(_T("Progman"), NULL), &thumbnail);
if (SUCCEEDED(hr))
{
// Display the thumbnail using DwmUpdateThumbnailProperties
}
return hr;
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | dwmapi.h |
Library | Dwmapi.lib |
DLL | Dwmapi.dll |