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.
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)
Related Call: GetCursorPos
Category: Cursor
Back to the index.