# GetClipCursor Function

`Declare Function GetClipCursor Lib "user32.dll" (lprc As RECT) As Long`

GetClipCursor finds the current confinement rectangle of the mouse cursor. The mouse cursor is confined by using ClipCursor. The cursor is confined inside this rectangle -- even SetWindowPos cannot free it. If there is no apparent confinement rectangle, it is actually the size of the screen. The coordinates of the rectangle is put into lprc. The function returns 0 if an error occured, and a non-zero value if it succeeded.

lprcReceives the coordinates of the confinement rectangle.

Example:

    Dim r As RECT
    ' Print the coordinates of the confinement rectangle.
    x = GetClipCursor(r)
    Debug.Print r.Left; r.Top  ' upper-left (x,y) pair
    Debug.Print r.Right; r.Bottom  ' lower-right (x,y) pair

Related Call: ClipCursor
Category: Mouse
Back to the index.