CRichEditCtrl::SetSel

void SetSel( long nStartChar**, long** nEndChar );

void SetSel( CHARRANGE& cr );

Parameters

nStartChar

Zero-based index of the first character for the selection.

nEndChar

Zero-based index of the last character for the selection.

cr

structure which holds the bounds of the current selection.

Remarks

Call this function to set the selection within this CRichEditCtrl object.

The two forms of this function provide alternate ways to set the bounds for the selection. Brief descriptions of these forms follow:

  • SetSel( cr )   This form uses the CHARRANGE structure with its cpMin and cpMax members to set the bounds.

  • SetSel( nStartChar**,** nEndChar )   This form use the parameters nStartChar and nEndChar to set the bounds.

The caret is placed at the end of the selection indicated by the greater of the start (cpMin or nStartChar) and end (cpMax or nEndChar) indices. This function does not scroll the contents of the CRichEditCtrl so that the caret is visible.

To select all the text in this CRichEditCtrl object, call SetSel with a start index of 0 and an end index of  – 1.

For more information, see message and structure in the Win32 documentation.

Example

See the example for GetSel.

CRichEditCtrl OverviewClass MembersHierarchy Chart

See Also   CRichEditCtrl::GetSel, CRichEditCtrl::GetSelectionType