WinGetState
获取窗口的状态.
WinGetState ( "title" [, "text"] )
参数
title
|
目标窗口标题, 或句柄, 或类名. 参考 窗口标题与文本.
|
text
|
[可选] 目标窗口文本. 默认值为空字符串. 参考 窗口标题与文本.
|
返回值
成功:
|
返回一个指示窗口状态的值. 使用 BitAND() 将多个状态值相加检查所需窗口的状态:
1 = 窗口存在
2 = 窗口可见
4 = 窗口激活
8 = 窗口处于活动状态
16 = 窗口最小化
32 = 窗口最大化
|
失败:
|
返回 0, @error 设置为 1, 未找到目标窗口.
|
常量定义在 "AutoItConstants.au3".
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
; Retrieve the state of the Notepad window using the handle returned by WinWait.
Local $iState = WinGetState($hWnd)
; Check if the Notepad window is minimized and display the appropriate message box.
If BitAND($iState, 16) Then
MsgBox($MB_SYSTEMMODAL, "", "Notepad is minimized and the state returned by WinGetState was - " & $iState)
Else
MsgBox($MB_SYSTEMMODAL, "", "Notepad isn't minimized and the state returned by WinGetState was - " & $iState)
EndIf
; Close the Notepad window using the handle returned by WinWait.
WinClose($hWnd)
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令调用 exect
参见:
WinSetState, BitAND, WinGetPos
exect=$var_istate=WinGetState('[CLASS:TTOTAL_CMD]')||_ViewValues($var_istate) ;; 返回值,指示Total Commander窗口的状态
exect=$var_istate=WinGetState('[CLASS:TTOTAL_CMD]')||$var_s=BitAND($var_istate,8)?'активно':'не~~активно'||_ViewValues('$var_s') ;; 确定活动或</ s> Total Commander窗口
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|