检索包含指定点的窗口句柄
#Include <WinAPI.au3>
_WinAPI_WindowFromPoint(ByRef $tPoint)
$tPoint | 定义检查点的 $tagPOINT 结构 |
成功: | 返回包含指定点的窗口句柄 |
失败: | 返回 0 |
在MSDN中搜索
#include <WinAPI.au3>
HotKeySet("{ESC}", "Close") ; Set ESC as a hotkey to exit the script.
Global $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked.
Example()
Func Example()
Local $hWnd
While 1
ToolTip("")
Position() ; Update the X and Y elements with the X and Y co-ordinates of the mouse.
$hWnd = _WinAPI_WindowFromPoint($tStruct) ; Retrieve the window handle.
ToolTip($hWnd) ; Set the tooltip with the handle under the mouse pointer.
Sleep(100)
WEnd
EndFunc ;==>Example
Func Position()
DllStructSetData($tStruct, "x", MouseGetPos(0))
DllStructSetData($tStruct, "y", MouseGetPos(1))
EndFunc ;==>Position
Func Close()
Exit
EndFunc ;==>Close