void GetSel( CHARRANGE& cr ) const;
void GetSel( long& nStartChar, long& nEndChar ) const;
Parameters
cr
Reference to a CHARRANGE structure to receive the bounds of the current selection.
nStartChar
Zero-based index of the first character in the current selection.
nEndChar
Zero-based index of the last character in the current selection.
Remarks
Call this function to retrieve the bounds of the current selection in this CRichEditCtrl object.
The two forms of this function provide alternate ways to get the bounds for the selection. Brief descriptions of these forms follow:
The selection includes everything if the beginning (cpMin or nStartChar) is 0 and the end (cpMax or nEndChar) is – 1.
For more information, see EM_EXGETSEL message and CHARRANGE structure in the Win32 documentation.
Example
// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl;
// Set the selection to be all characters after the current selection.
long nStartChar, nEndChar;
pmyRichEditCtrl->GetSel(nStartChar, nEndChar);
pmyRichEditCtrl->SetSel(nEndChar, -1);
CRichEditCtrl Overview | Class Members | Hierarchy Chart
See Also CRichEditCtrl::SetSel, CRichEditCtrl::GetSelText, CRichEditCtrl::GetParaFormat, CRichEditCtrl::GetSelectionCharFormat