ClipCursor

  BOOL ClipCursor(lprc)    
  CONST RECT *lprc; /* address of structure with rectangle */

The ClipCursor function confines the cursor to a rectangle on the screen. If a subsequent cursor position (set by the SetCursorPos function or the mouse), lies outside the rectangle, Windows automatically adjusts the position to keep the cursor inside.

Parameters

lprc

Points to a RECT structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, the cursor is free to move anywhere on the screen. The RECT structure has the following form:

typedef struct tagRECT { /* rc */

LONG left;

LONG top;

LONG right;

LONG bottom;

} RECT;

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The cursor is a shared resource. An application that has confined the cursor to a given rectangle must free it before relinquishing control to another application.

See Also

GetClipCursor, GetCursorPos, SetCursorPos