Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems


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

See Also: SetCursorPos Category: Cursor

Go back to the alphabetical Function listing. Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information. Go back to the Windows API Guide home page. E-mail: vbapi@vbapi.com Send Encrypted E-Mail This page is at http://www.vbapi.com/ref/g/getcursorpos.html

Категории