Creates a Desktop Window Manager (DWM) thumbnail relationship between the destination and source windows.
Syntax
HRESULT DwmRegisterThumbnail(
HWND hwndDestination,
HWND *hwndSource,
PHTHUMBNAIL phThumbnailId
);
Parameters
- hwndDestination
-
The handle to the window that will use the DWM thumbnail. Setting the destination window handles to anything other than a top level window type will result in an E_INVALIDARG.
- hwndSource
-
The handle to the window to as the thumbnail source. Setting the source window handles to anything other than a top level window type will result in an E_INVALIDARG.
- phThumbnailId
-
[out] The pointer to a handle that represents the registration of the DWM thumbnail.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
Registering a DWM thumbnail relationship will not modify desktop composition, see DwmUpdateThumbnailProperties for thumbnail positioning.
The window designated by the hwndDestination must either be the desktop window or be owned by the process calling DwmRegisterThumbnail . This is done to prevent applications affecting the content of other applications.
The thumbnail registration handle obtained by this function is not globally unique but is unique to the process. DwmUnregisterThumbnail is used to unregister the thumbnail and must be done within the process the relationship was registered in.
Example
The following sample demonstates how to register the Desktop thumbnail.
HRESULT UpdateDesktop(HWND hwnd)
{
HRESULT hr = S_OK;
//Register Thumbnail
HTHUMBNAIL thumbnail = NULL;
hr = DwmRegisterThumbnail(hwnd, FindWindow(_T("Progman"), NULL), &thumbnail);
if (SUCCEEDED(hr))
{
//display thumbnail using DwmUpdateThumbnailProperties
}
return hr;
}
Function Information
| Minimum DLL Version | dwmapi.dll |
|---|
| Header | dwmapi.h |
|---|
| Import library | dwmapi.lib |
|---|
| Minimum operating systems |
Windows Vista |
|---|
See Also