Function Reference


_WinAPI_DwmEnableBlurBehindWindow

Enables the blur effect on a specified window

#include <WinAPIGdi.au3>
_WinAPI_DwmEnableBlurBehindWindow ( $hWnd [, $bEnable = True [, $bTransition = False [, $hRgn = 0]]] )

Parameters

$hWnd Handle to the window on which the blur behind data is applied.
$bEnable [optional] Specifies whether register or unregister the window handle to DWM blur behind, valid values:
    True    - Register (Default).
    False - Unregister.
$bTransition [optional] Specifies whether colorize transition to match the maximized windows, valid values:
    True    - The window's should be colorized.
    False - Otherwise (Default).
$hRgn [optional] The region within the client area to apply the blur behind.
A value of zero (Default) will apply the blur behind the entire client area.

Return Value

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

Remarks

The alpha values in the window are honored and the rendering atop the blur will use these alpha values.
It is the application's responsibility for ensuring that the alpha values of all pixels in the window are correct.
Some Windows Graphics Device Interface (GDI) operations do not preserve alpha values, so care must be taken when presenting child windows because the alpha values they contribute are unpredictable.

This function must be called whenever Desktop Window Manager (DWM) composition is toggled.
Handle the WM_DWMCOMPOSITIONCHANGED message for composition change notification.

This function requires Windows Vista or later.

See Also

Search DwmEnableBlurBehindWindow in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIHObj.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

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

GUISetBkColor(0)

; Create the "sheet of glass" effect for the specified region. You must call this function whenever DWM composition is toggled.
_WinAPI_DwmGetColorizationColor()
Local $hRgn = _WinAPI_CreateEllipticRgn(_WinAPI_CreateRectEx(50, 50, 300, 300))
_WinAPI_DwmEnableBlurBehindWindow($hForm, 1, 0, $hRgn)
If $hRgn Then
        _WinAPI_DeleteObject($hRgn)
EndIf

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE