Declare Function GetCursorPos Lib "user32.dll" (ByVal lpPoint As POINTAPI) As Long
GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor are put into the variable passed as lpPoint. The function returns 0 if an error occured, or a non-zero value if it succeeded.
Example:
Dim coord As POINTAPI
' Display the coordinates of the mouse cursor
x = GetCursorPos(coord)
Debug.Print "The mouse is at"; coord.x; coord.y
Related Call: SetCursorPos
Category: Mouse
Back to the index.