UDF > WinAPIEx > Miscellaneous > Mouse >


_WinAPI_GetMousePos

Obtient la position actuelle de la souris

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

Paramètres

$bToClient [optionnel] Si True, les coordonnées seront converties en coordonnées client
$hWnd [optionnel] Handle de fenêtre utilisé pour convertir les coordonnées si $bToClient est True

Valeur de retour

Succès: Retourne une structure $tagPOINT avec la position actuelle de la souris.
Échec: Définit @error <> 0.

Remarque

Cette fonction prend en compte le paramètre MouseCoordMode courant lors de l'obtention de la position de la souris.
Les coordonnées écran seront également converties en coordonnées client suivant les paramètres passés.

En relation

$tagPOINT, _WinAPI_GetMousePosX, _WinAPI_GetMousePosY

Exemple

#include <MsgBoxConstants.au3>
#include <WinAPIMisc.au3>

Example()

Func Example()
    Local $hWnd = GUICreate("test")
    Local $tPoint = _WinAPI_GetMousePos()
    Local $tPoint2 = _WinAPI_GetMousePos(True, $hWnd)

    MsgBox($MB_SYSTEMMODAL, "Mouse Pos", _
            "X = " & DllStructGetData($tPoint, "X") & @CRLF & "Y = " & DllStructGetData($tPoint, "Y") & @CRLF & @CRLF & _
            "Client" & @CRLF & "X = " & DllStructGetData($tPoint2, "X") & @CRLF & "Y = " & DllStructGetData($tPoint2, "Y"))
EndFunc   ;==>Example