Function Reference


_WinAPI_DwmUpdateThumbnailProperties

Specifies Desktop Window Manager (DWM) thumbnail properties

#include <WinAPIGdi.au3>
_WinAPI_DwmUpdateThumbnailProperties ( $hThumbnail [, $bVisible = True [, $bClientAreaOnly = False [, $iOpacity = 255 [, $tRectDest = 0 [, $tRectSrc = 0]]]]] )

Parameters

$hThumbnail Handle of the thumbnail to retrieve the source window size from.
$bVisible [optional] Specifies whether make the thumbnail visible or invisible, valid values:
    True    - Visible (Default).
    False    - Invisible.
$bClientAreaOnly [optional] Specifies whether use only the thumbnail source's client area or entire window, valid values:
    True    - Use only source's client area.
    False    - Use entire window (Default).
$iOpacity [optional] The opacity with which to render the thumbnail. 0 is fully transparent while 255 (Default) is fully opaque.
$tRectDest [optional] $tagRECT structure containing the rectangle in the destination window the thumbnail will be rendered.
By default, the size of this rectangle equal to the source size of the DWM thumbnail which returns the _WinAPI_DwmQueryThumbnailSourceSize() function.
$tRectSrc [optional] $tagRECT structure containing the rectangle that specifies the region of the source window to use as the thumbnail.
By default, the entire window is used as the thumbnail.

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

Remarks

Thumbnail relationships created by _WinAPI_DwmRegisterThumbnail() will not be rendered to the destination window until this function is called.
Subsequent calls will update the thumbnail according to the properties.

This function requires Windows Vista or later.

Related

_WinAPI_DwmQueryThumbnailSourceSize, _WinAPI_DwmRegisterThumbnail

See Also

Search DwmUpdateThumbnailProperties in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIMisc.au3>

If Not _WinAPI_DwmIsCompositionEnabled() Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
        Exit
EndIf

Run(@SystemDir & '\calc.exe')
Local $hWnd = WinWaitActive("[CLASS:ApplicationFrameWindow]", '', 3)
If Not $hWnd Then
        Exit
EndIf

; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 400)

GUISetBkColor(0)

; Create the "sheet of glass" effect for the entire window. You must call this function whenever DWM composition is toggled.
_WinAPI_DwmExtendFrameIntoClientArea($hForm)

; Create a DWM thumbnail relationship (2:1)
Local $hThumbnail = _WinAPI_DwmRegisterThumbnail($hForm, $hWnd)
Local $tSIZE = _WinAPI_DwmQueryThumbnailSourceSize($hThumbnail)
Local $iWidth = DllStructGetData($tSIZE, 1)
Local $iHeight = DllStructGetData($tSIZE, 2)
Local $tDestRect = _WinAPI_CreateRectEx((400 - $iWidth / 2) / 2, (400 - $iHeight / 2) / 2, $iWidth / 2, $iHeight / 2)
Local $tSrcRect = _WinAPI_CreateRectEx(-20, -20, $iWidth + 40, $iHeight + 40)
_WinAPI_DwmUpdateThumbnailProperties($hThumbnail, 1, 0, 255, $tDestRect, $tSrcRect)

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

WinClose("[CLASS:ApplicationFrameWindow]", "")