SetCursorPos

  BOOL SetCursorPos(X, Y)    
  int X; /* horizontal position */
  int Y; /* vertical position */

This function moves the cursor to the screen coordinates given by the X and Y parameters. If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function, Windows automatically adjusts the coordinates so that the cursor stays within the rectangle.

Parameters

X

Specifies the new x-coordinate (in screen coordinates) of the cursor.

Y

Specifies the new y-coordinate (in screen coordinates) of the cursor.

Return Value

TRUE is returned for success, FALSE for failure.

Comments

The cursor is a shared resource. A window should move the cursor only when the cursor is in its client area.

See Also

ClipCursor, ShowCursor, GetCursorPos, SetCursor, SetCaretPos