SetCaretPos function (winuser.h)
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.
BOOL SetCaretPos( [in] int X, [in] int Y );
The new x-coordinate of the caret.
The new y-coordinate of the caret.
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.
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.
For an example, see Creating and Displaying a Caret.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-caret-l1-1-0 (introduced in Windows 8)|