This documentation is archived and is not being maintained.


Sets the position of the caret.

static void PASCAL SetCaretPos(
   POINT point 



Specifies the new x and y coordinates (in client coordinates) of the caret.

The SetCaretPos member function moves the caret only if it is owned by a window in the current task. SetCaretPos moves the caret whether or not the caret is hidden.

The caret is a shared resource. A window should not move the caret if it does not own the caret.

// The following code snippet shows a caret when the left 
// mouse button is pressed, and sets the caret's positon to 
// the cursor's position.

void CMyView::OnLButtonDown(UINT nFlags, CPoint point) 
   //create a solid caret, the width is 2, the length is 20.
   CreateSolidCaret (2, 20);
   SetCaretPos (point);
   ShowCaret ();

   CView::OnLButtonDown(nFlags, point);