返回当前鼠标位置
#Include <WinAPI.au3>
_WinAPI_GetMousePos([$fToClient = False [, $hWnd = 0]])
$fToClient | [可选参数] 如为 True, 坐标将被转换为客户坐标 |
$hWnd | [可选参数] 如 $fToClient 为 True, 则指定窗口句柄 |
成功: | 返回当前鼠标位置的 $tagPOINT 结构 | |
失败: | 设置@error: |
#include <WinAPI.au3>
_Main()
Func _Main()
Local $hwnd = GUICreate("test")
Local $tPoint = _WinAPI_GetMousePos()
Local $tPoint2 = _WinAPI_GetMousePos(True, $hwnd)
MsgBox(4096, "Mouse Pos", _
"X = " & DllStructGetData($tPoint, "X") & @LF & "Y = " & DllStructGetData($tPoint, "Y") & @LF & @LF & _
"Client" & @LF & "X = " & DllStructGetData($tPoint2, "X") & @LF & "Y = " & DllStructGetData($tPoint2, "Y"))
EndFunc ;==>_Main