This is how to do it with the built-in UDF functions:
#include <WinAPI.au3>
#include <Misc.au3>
Local $stPoint=DllStructCreate($tagPOINT),$aPos,$hControl,$hWin,$aLastPos[2]=[-1,-1],$sLastStr='',$sStr
While Not _IsPressed('1B')
$aPos=MouseGetPos()
If $aPos[0]<>$aLastPos[0] Or $aPos[1]<>$aLastPos[1] Then
DllStructSetData($stPoint,1,$aPos[0])
DllStructSetData($stPoint,2,$aPos[1])
$hControl=_WinAPI_WindowFromPoint($stPoint)
$hWin=_WinAPI_GetAncestor($hControl,2)
$sStr='Window at '&$aPos[0]&','&$aPos[1]&': "'&WinGetTitle($hWin)&'"'
If $sLastStr<>$sStr Then
ToolTip($sStr,0,@DesktopHeight-20)
$sLastStr=$sStr
EndIf
$aLastPos=$aPos
EndIf
Sleep(15)
WEnd
On a side note - I'd just like to add that _WinAPI_WindowFromPoint() was poorly thought out - it should take x,y coordinates instead of a structure.