2.2.6.27.20 RichEdit::ReplaceSel

Description

Replaces the current selection in this RichEdit control with specified text.

Syntax

void ReplaceSel( LPCTSTR lpszNewText, BOOL bCanUndo = FALSE )

Parameters

lpszNewText
Pointer to a null-terminated string
containing the replacement text.
bCanUndo
To specify that this function can be undone,
set the value of this parameter to TRUE. The default value is FALSE.

Return

void

Examples

EX1

#include <..\OriginLab\DialogEx.h>
#define IDC_RICHEDIT1 1001
 
void RichEdit_ReplaceSel(Dialog& EditBoxes)
{
	RichEdit richEdit = EditBoxes.GetItem(IDC_RICHEDIT1);
	richEdit.SetSel(0, -1);
	string str = "Sample";
	richEdit.ReplaceSel(str, FALSE);
	ASSERT( richEdit.Text == str );
}

Remark

See Also

RichEdit::SetSel

Header to Include

Control.h