Function Reference


_WinAPI_GetMousePosX

Returns the current mouse X position

#include <WinAPI.au3>
_WinAPI_GetMousePosX ( [$bToClient = False [, $hWnd = 0]] )

Parameters

$bToClient [optional] If True, the coordinates will be converted to client coordinates
$hWnd [optional] Window handle used to convert coordinates if $bToClient is True

Return Value

Success: the mouse X position
Failure: sets the @error flag to non-zero.

Remarks

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.

Related

_WinAPI_GetMousePos

Example

#include <MsgBoxConstants.au3>
#include <WinAPI.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