CRichEdit.ReplaceSelmethod
Replaces the current selection in a rich edit control with the specified text.
Syntax
SUB ReplaceSel (BYVAL hRichEdit AS HWND, BYVAL bCanBeUndone AS LONG, BYVAL pwszText AS WSTRING PTR)
Parameters
| Name | Description | |
|---|---|---|
hRichEdit | The handle of the rich edit control. | |
bCanBeUndone | Specifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is FALSE, the operation cannot be undone. | |
pwszText | A pointer to a null-terminated string containing the replacement text. |
Description
Replaces the current selection in a rich edit control with the specified text.
Remarks
Use the ReplaceSel message to replace only a portion of the text in an edit control. To replace all of the text, use the SetText message or the SetWindowText Windows API function.
If there is no selection, the replacement text is inserted at the caret.
In a rich edit control, the replacement text takes the formatting of the character at the caret or, if there is a selection, of the first character in the selection.
Reference
- Defined in AfxNova/CRichEdit.inc:897
- Documented in Windows/WIndows Controls/CRichEdit Class.md
- Topic: CRichEdit Class