GetCursorPos Function

Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long

Platforms: Win 32s, Win 95/98, Win NT

GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor (relative to the screen) are put into the variable passed as lpPoint. The function returns 0 if an error occured or 1 if it is successful.

lpPoint
Receives the x and y coordinates of the mouse cursor.

Example:

' Display the coordinates of the mouse cursor
Dim coord As POINT_TYPE  ' receives coordinates of cursor
Dim retval As Long  ' return value

retval = GetCursorPos(coord)  ' read cursor location
Debug.Print "The mouse is at:"; coord.x; coord.y

Related Call: SetCursorPos
Category: Cursor
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/g/getcursorpos.html