如何枚举当前窗口下所有控件ID,在线等!
我搜索了下论坛,找到了sanhen大师的一段UDF。不过只能获取到控件的类名,我想获取控件的ID。不知道该怎么改
#Include <array.au3>
Global $avCtrlList =
$Title = "AutoIt Help"
$Text = ""
$ClassNames = _WinGetClassNameList($Title, $Text)
ConsoleWrite($ClassNames)
MsgBox(0,0,$ClassNames)
;==================================================
; Function _WinGetClassNameList()
; Returns a string containing a list of all ClassNameNN control IDs in a window.
; On success returns all ClassNameNN's in a string delimited by @LF.
; On failure returns 0 and sets @error.
;==================================================
Func _WinGetClassNameList($sWinTitle = "", $sWinText = "")
Local $c, $NN, $hCtrl
; Get list of classes in the window
Local $sClassList = WinGetClassList($sWinTitle, $sWinText)
If @error Then Return SetError(1, 0, 0)
Local $avClassList = StringSplit($sClassList, @LF)
; Try different values of NN
$sClassList = ""
For $c = 1 To $avClassList
$NN = 1
While 1
$hCtrl = ControlGetHandle($sWinTitle, $sWinText, $avClassList[$c] & $NN)
If @error Then
ExitLoop
Else
$sClassList &= $avClassList[$c] & $NN & @LF
$NN += 1
EndIf
WEnd
Next
Return $sClassList
EndFunc ;==>_WinGetClassNameList
[ 本帖最后由 黑菜 于 2009-2-11 16:17 编辑 ] :face (37):
没人帮我吗??等了一天了。。。。 http://www.autoitx.com/forum.php?mod=viewthread&tid=3947&extra=page%3D1
可以了。大师给补充了
页:
[1]