Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WinAPI.au3>
- #include <WindowsConstants.au3>
- AdlibRegister("_Mouse_Win_GetInfoAdlib", 10)
- While 1
- ConsoleWrite("Start Sleep" & @CRLF)
- Sleep(0x7FFFFFFF)
- WEnd
- Func _Mouse_Win_GetInfoAdlib()
- Local $a_info = _Mouse_Win_GetInfo()
- If @error Then Return
- ToolTip("Window Handle = " & $a_info[0] & @CRLF & _
- "Window Title = " & $a_info[1] & @CRLF & _
- "Control Handle = " & $a_info[2] & @CRLF & _
- "Control Class = " & $a_info[3] & @CRLF & _
- "Mouse X Pos = " & $a_info[4] & @CRLF & _
- "Mouse Y Pos = " & $a_info[5])
- EndFunc ;==>_Mouse_Win_GetInfoAdlib
- Func _Mouse_Win_GetInfo()
- Local $structCoords, $a_mpos, $hWnd, $hControl, $sClass
- $structCoords = DllStructCreate($tagPOINT) ; Build Structure
- $a_mpos = MouseGetPos() ; Get Mouse Position
- If @error Then Return SetError(1, 0, 0)
- DllStructSetData($structCoords, "X", $a_mpos[0]) ; Populate Structure
- DllStructSetData($structCoords, "Y", $a_mpos[1]) ; Populate Structure
- $hControl = _WinAPI_WindowFromPoint($structCoords) ; Identify Window
- If Not $hControl Then Return SetError(2, 0, 0)
- $hWnd = _WinAPI_GetAncestor($hControl, $GA_ROOTOWNER); Get Parent Window
- $sClass = _WinAPI_GetClassName($hControl) ; Get Control Class
- If Not $hWnd Then Return SetError(3, 0, 0)
- Local $a_ret[6] = [$hWnd, WinGetTitle($hWnd), $hControl, $sClass, $a_mpos[0], $a_mpos[1]]
- Return $a_ret
- EndFunc ;==>_Mouse_Win_GetInfo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement