获取指定窗口应用属性的当前值.
#Include <WinAPIEx.au3>
_WinAPI_DwmGetWindowAttribute ( $hWnd, $iAttribute )
$hWnd | 要获取属性数据的窗口的窗口句柄. |
$iAttribute | 属性.参数可以是以下值之一: $DWMWA_NCRENDERING_ENABLED --- 确定是否启用非客户端绘制 $DWMWA_CAPTION_BUTTON_BOUNDS --- 检索窗口相对空间标题按钮区域的边界. $DWMWA_EXTENDED_FRAME_BOUNDS --- 检索屏幕空间矩形扩展帧 |
成功: | 返回属性的当前值.值的类型取决于 $iAttribute 的参数值. |
失败: | 返回 0,设置 @error 标志为非 0 值, @extended 标志可能包含一个系统错误代码. |
在MSDN中搜索
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
If Not _WinAPI_DwmIsCompositionEnabled() Then
MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.')
Exit
EndIf
Global $hWnd, $Pos
Run(@SystemDir & '\calc.exe')
$hWnd = WinWaitActive('Calculator', '', 3)
If Not $hWnd Then
Exit
EndIf
$Pos = _WinAPI_GetPosFromRect(_WinAPI_DwmGetWindowAttribute($hWnd, $DWMWA_EXTENDED_FRAME_BOUNDS))
ConsoleWrite('Left: ' & $Pos[0] & @CR)
ConsoleWrite('Top: ' & $Pos[1] & @CR)
ConsoleWrite('Width: ' & $Pos[2] & @CR)
ConsoleWrite('Height: ' & $Pos[3] & @CR)