SetCursorPos Function

Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long

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

SetCursorPos sets the position of the mouse cursor. If you try to set the coordinates outside of the range of the display (for example, to (700,40) on a 640x480 display) or outside the confining rectangle (set by ClipCursor), the cursor will just go to the edge of the screen or the rectangle. The function returns 0 if an error occured, or 1 if successful.

x
The x coordinate to move the cursor to.
y
The y coordinate to move the cursor to.

Example:

' Move the mouse cursor to the point (100,200) on the screen
Dim retval As Long  ' return value

retval = SetCursorPos(100, 200)  ' move the cursor to (100,200)

See Also: GetCursorPos
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/s/setcursorpos.html