Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
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. The function returns 0 if an error occured, or a non-zero value if successful.
Example:
' Put the cursor at (100, 200)
x = SetCursorPos(100, 200)
Related Call: GetCursorPos
Category: Mouse
Back to the index.