INFO: SetCaretPos() Is Not Appropriate with CEdit or CRichEditCtrl Controls

Article translations Article translations
Article ID: 259949 - View products that this article applies to.
This article was previously published under Q259949
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

Summary

You cannot use the SetCaretPos function to set the caret position for CEdit or CRichEditCtrl controls. You should use the SetSel function instead.

More information

The caret is a shared resource. A window should not move the caret if it does not own the caret. You cannot use the SetCaretPos function to change the position of the caret because the control doesn't own the caret.

To move the caret, use the SetSel function and specify the same position for both the start and end parameters. This moves the text insertion point, and repositions the caret.

References

Online help for SetCaretPos()

Properties

Article ID: 259949 - Last Review: October 26, 2013 - Revision: 2.0
Applies to
  • Microsoft Foundation Class Library 4.2
Keywords: 
kbnosurvey kbarchive kbcaret kbcursor kbinfo KB259949

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com