本帖最后由 lainline 于 2010-3-30 18:53 编辑
类似窗口信息工具的功能#include<Array.AU3>
HotKeySet("{ESC}","_EXIT")
Opt("MouseCoordMode",2)
_MAIN()
Func _MAIN()
Global $DD[1]
While 1
$ASD=WinList()
ReDim $DD[$ASD[0][0]+1]
$DD[0]=$ASD[0][0]
For $S=1 To $ASD[0][0]
$DD[$S] = $ASD[$S][1]
Next
For $TT In $DD
If Not WinActive ( $TT, "")=0 Then
Local $classl=_WinGetCtrlInfo($TT)
_GET_WINDOWS($TT,$classl)
EndIf
Next
Sleep(50)
WEnd
EndFunc
Func _EXIT()
Exit
EndFunc
Func _GET_WINDOWS($hWINDOW,$class2)
Local $end[1]
For $ttt=1 To $class2[0][0]
;_ArrayDisplay($class2)
$SDFAmouse =MouseGetPos ();鼠标位置
$SDFA =ControlGetPos ($hWINDOW, "", $class2[$ttt][0]);位置
If Not @error Then
If $SDFAmouse[0]>=$SDFA[0] And $SDFAmouse[0]<= $SDFA[0]+$SDFA[2] And $SDFAmouse[1]>=$SDFA[1] And $SDFAmouse[1]<= $SDFA[1]+$SDFA[3] Then
_ArrayAdd($end,$class2[$ttt][0])
EndIf
EndIf
Next
ToolTip("hwindow:"&$hWINDOW & @LF & "Class:" & _ArrayToString($end))
EndFunc
Func _WinGetCtrlInfo($hWin)
If IsString($hWin) Then $hWin = WinGetHandle($hWin)
Local $sClassList = WinGetClassList($hWin), $iAdd = 1, $aDLL, $sHold
Local $aSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn[1][2]
For $iCount = $aSplitClass[0] To 1 Step - 1
Local $nCount = 0
While 1
$nCount += 1
If ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount) = '' Then ExitLoop
If Not StringInStr(Chr(1) & $sHold, Chr(1) & $aSplitClass[$iCount] & $nCount & Chr(1)) Then
$sHold &= $aSplitClass[$iCount] & $nCount & Chr(1)
$iAdd += 1
ReDim $aReturn[$iAdd][2]
$aReturn[$iAdd - 1][0] = $aSplitClass[$iCount] & $nCount
$aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', _
ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount))
If @error = 0 Then
$aReturn[$iAdd - 1][1] = $aDLL[0]
Else
$aReturn[$iAdd - 1][1] = ''
EndIf
EndIf
WEnd
Next
$aReturn[0][0] = $iAdd - 1
Return $aReturn
EndFunc ;==>_WinGetCtrlInfo()
|