endlesslove_1998

Get the title of the window under mouse

Dec 10th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.62 KB | None | 0 0
  1. #include <WinAPI.au3>
  2.  
  3. HotKeySet("{ESC}", "_Exit")
  4.  
  5. Local $tPoint = DllStructCreate($tagPOINT)
  6.  
  7. Local $hWnd
  8.  
  9. While 1
  10.     ToolTip("")
  11.     DllStructSetData($tPoint, "x", MouseGetPos(0))
  12.     DllStructSetData($tPoint, "y", MouseGetPos(1))
  13.  
  14.     $hWnd = _GetParent(_WinAPI_WindowFromPoint($tPoint))
  15.     ToolTip(WinGetTitle($hWnd))
  16.     Sleep(100)
  17. WEnd
  18.  
  19. Func _GetParent($hWnd)
  20.     Local $hParent = $hWnd
  21.     While 1
  22.         Local $hCurrent = _WinAPI_GetParent($hParent)
  23.         If IsHWnd($hCurrent) Then
  24.             $hParent = $hCurrent
  25.         Else
  26.             ExitLoop
  27.         EndIf
  28.     WEnd
  29.     Return $hParent
  30. EndFunc   ;==>_GetParent
  31.  
  32. Func _Exit()
  33.     Exit
  34. EndFunc   ;==>_Exit
Advertisement
Add Comment
Please, Sign In to add comment