找回密码
 加入
搜索
查看: 1977|回复: 1

[AU3基础] 为什么ControlGetText返回为空(传入窗口句柄) [已解决]

[复制链接]
发表于 2010-4-11 10:02:24 | 显示全部楼层 |阅读模式
本帖最后由 xiehuahere 于 2010-4-11 11:59 编辑

代码如下,还请帮忙找找原因:
Opt("WinDetectHiddenText", 1)
Opt("WinTitleMatchMode", 4)
$windowFound = False

$controlID = "[CLASSNN:Static3]"
$matchText = "欢迎画面"

$WinArr = WinList("[CLASS:#32770]")

For $i = 1 To $WinArr[0][0]
    $text = ControlGetText($WinArr[$i][1], "", $controlID)
    ConsoleWrite($WinArr[$i][1] & ": " & $text & @LF)   ;[b]不知为什么这里输出的$text都是空,难道中文不行吗?
    If ControlGetText($WinArr[$i][1], "", $controlID) = $matchText Then
        $windowFound = True
        ExitLoop
    EndIf
Next

If $windowFound Then
    MsgBox(0, "WinExists", "The target window does indeed exist.")
Else
    MsgBox(0, "Not Found", ";-(")
EndIf
多谢!

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

 楼主| 发表于 2010-4-11 11:16:20 | 显示全部楼层
发现用数字ID可以获取到控件的Text,怪了。。。
$controlID = "[ID: 1054]"

可能正如帮助里说的,数字ID - “It is generally the best method of identifying controls.”
就用这个吧。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-3 11:47 , Processed in 0.081200 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表