WinExists

首页  后退  前进

WinExists
down2

WinExists

检查指定窗口是否存在.

 

WinExists ( "title" [, "text"] )

参数

title

目标窗口标题, 或句柄, 或类名. 参考 窗口标题与文本.

text

[可选] 目标窗口文本. 默认值为空字符串. 参考 窗口标题与文本.

返回值

成功:

返回 1, 窗口存在.

失败:

返回 0, 窗口不存在.

备注

即使目标窗口处于隐藏状态, WinExists 仍将返回 1.

 

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    ; Run Notepad
    Run("notepad.exe")
    ; Wait 10 seconds for the Notepad window to appear.
    WinWait("[CLASS:Notepad]", "", 10)
    ; Test if the window exists and display the results.
    If WinExists("[CLASS:Notepad]") Then
        MsgBox($MB_SYSTEMMODAL, "", "Window exists")
    Else
        MsgBox($MB_SYSTEMMODAL, "", "Window does not exist")
    EndIf
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令调用 exect

参见:

WinActive, WinWait, WinWaitActive, WinWaitClose, WinWaitNotActive, WinTitleMatchMode (Опция), ProcessExists, WinClose

例子
copy

exect=$var_handle=WinGetHandle('[CLASS:Notepad]')||$var_s=WinExists(Eval('var_handle'))?'существует':'не~~существует'||_ViewValues('$var_s') ;; 检查记事本窗口是否存在

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru