lainline 发表于 2010-2-19 21:56:57

[已解决] 类重叠怎么知道哪个类在顶层 给哪个类发送鼠标点击消息

本帖最后由 lainline 于 2010-3-30 18:53 编辑

类似窗口信息工具的功能#include<Array.AU3>
HotKeySet("{ESC}","_EXIT")
Opt("MouseCoordMode",2)
_MAIN()

Func _MAIN()
Global        $DD

While 1
$ASD=WinList()

ReDim $DD[$ASD+1]
$DD=$ASD
For $S=1 To $ASD
$DD[$S] = $ASD[$S]
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
For $ttt=1 To $class2
        ;_ArrayDisplay($class2)
$SDFAmouse =MouseGetPos ();鼠标位置
$SDFA =ControlGetPos ($hWINDOW, "", $class2[$ttt]);位置
If Not @error Then
If $SDFAmouse>=$SDFA And $SDFAmouse<= $SDFA+$SDFA And $SDFAmouse>=$SDFA And $SDFAmouse<= $SDFA+$SDFA Then
_ArrayAdd($end,$class2[$ttt])
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
    For $iCount = $aSplitClass 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]
                $aReturn[$iAdd - 1] = $aSplitClass[$iCount] & $nCount
                $aDLL = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', _
                  ControlGetHandle($hWin, '', $aSplitClass[$iCount] & $nCount))
                If @error = 0 Then
                  $aReturn[$iAdd - 1] = $aDLL
                Else
                  $aReturn[$iAdd - 1] = ''
                EndIf
            EndIf
      WEnd
    Next
    $aReturn = $iAdd - 1
    Return $aReturn
EndFunc   ;==>_WinGetCtrlInfo()

lainline 发表于 2010-2-19 21:58:39

是否和控件ID的大小有关?

lainline 发表于 2010-2-19 22:24:16

在英文站上问到了 _WinAPI_WindowFromPoint 自问自答晕
页: [1]
查看完整版本: [已解决] 类重叠怎么知道哪个类在顶层 给哪个类发送鼠标点击消息