Returns the current mouse X position
#include <WinAPIMisc.au3>
_WinAPI_GetMousePosX ( [$bToClient = False [, $hWnd = 0]] )
$bToClient | [optional] If True, the coordinates will be converted to client coordinates |
$hWnd | [optional] Window handle used to convert coordinates if $bToClient is True |
Success: | the mouse X position |
Failure: | sets the @error flag to non-zero. |
This function takes into account the current MouseCoordMode setting when obtaining the mouse position. It
will also convert screen to client coordinates based on the parameters passed.
#include <MsgBoxConstants.au3>
#include <WinAPIMisc.au3>
Example()
Func Example()
Local $hWnd = GUICreate("test")
Local $iX = _WinAPI_GetMousePosX()
Local $iX2 = _WinAPI_GetMousePosX(True, $hWnd)
Local $iY = _WinAPI_GetMousePosY()
Local $iY2 = _WinAPI_GetMousePosY(True, $hWnd)
MsgBox($MB_SYSTEMMODAL, "Mouse Pos", "X = " & $iX & @CRLF & "Y = " & $iY & @CRLF & @CRLF & _
"Client" & @CRLF & "X = " & $iX2 & @CRLF & "Y = " & $iY2)
EndFunc ;==>Example