RichEdit::GetSel

Description

Gets the starting and ending positions of the current selection in this RichEdit control.

Syntax

void GetSel( long & nStartChar, long & nEndChar )

Parameters

nStartChar
Zero-based index of the first character in
the current selection.
nEndChar
Zero-based index of the last character in
the current selection.

Return

void

Examples

EX1

#include <..\OriginLab\DialogEx.h>
#define IDC_RICHEDIT1 1001

void RichEdit_GetSel(Dialog& EditBoxes)
{
        RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
        long nStartChar, nEndChar;
        richEdit.GetSel(nStartChar, nEndChar);    
        string str;
        str.Format("Start:%d, End:%d\n", nStartChar, nEndChar);
        MessageBox(NULL, str, "Rich Edit Sample");
}

Remark

Call this function to retrieve the bounds of the current selection in this RichEdit control.

See Also

RichEdit::SetSel

Header to Include

Control.h