Export (0) Print
Expand All

SetCaretPos function

Moves the caret to the specified coordinates. If the window that owns the caret was created with the CS_OWNDC class style, then the specified coordinates are subject to the mapping mode of the device context associated with that window.

Syntax


BOOL WINAPI SetCaretPos(
  _In_  int X,
  _In_  int Y
);

Parameters

X [in]

Type: int

The new x-coordinate of the caret.

Y [in]

Type: int

The new y-coordinate of the caret.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

SetCaretPos moves the caret whether the caret is hidden.

The system provides one caret per queue. A window should create a caret only when it has the keyboard focus or is active. The window should destroy the caret before losing the keyboard focus or becoming inactive. A window can set the caret position only if it owns the caret.

Examples

For an example, see Creating and Displaying a Caret.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetCaretPos
HideCaret
ShowCaret
Conceptual
Carets

 

 

Community Additions

ADD
Show:
© 2014 Microsoft