Function Reference


_WinAPI_DwmGetWindowAttribute

Retrieves the current value of a specified attribute applied to the window

#include <WinAPIGdi.au3>
_WinAPI_DwmGetWindowAttribute ( $hWnd, $iAttribute )

Parameters

$hWnd Handle to the window for which the attribute data is retrieved.
$iAttribute The attribute to retrieve. This parameter can be one of the following values:
    $DWMWA_NCRENDERING_ENABLED
    $DWMWA_CAPTION_BUTTON_BOUNDS
    $DWMWA_EXTENDED_FRAME_BOUNDS

Return Value

Success: The value that contains the current value of the attribute.
    The type of the returned value depends on the value of the $iAttribute parameter.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

Remarks

This function requires Windows Vista or later.

See Also

Search DwmGetWindowAttribute in MSDN Library.

Example

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

Local $aPos = _WinAPI_GetPosFromRect(_WinAPI_DwmGetWindowAttribute($hWnd, $DWMWA_EXTENDED_FRAME_BOUNDS))

ConsoleWrite('Left:   ' & $aPos[0] & @CRLF)
ConsoleWrite('Top:    ' & $aPos[1] & @CRLF)
ConsoleWrite('Width:  ' & $aPos[2] & @CRLF)
ConsoleWrite('Height: ' & $aPos[3] & @CRLF)