Help Center

CRichEdit.SetTextExWmethod

Combines the functionality of WM_SETTEXT and EM_REPLACESEL and adds the ability to set text using a code page and to use either Rich Text Format (RTF) rich text or plain text.

Windowsmethoddocumented

Syntax

FUNCTION SetTextExW (BYVAL hRichEdit AS HWND, BYVAL pstex AS SETTEXTEX PTR, BYVAL pwszText AS WSTRING PTR) AS DWORD

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
pstexPointer to a SETTEXTEX structure that specifies flags and an optional code page to use in translating to Unicode.
pwszTextPointer to the null-terminated text to insert. This text is an ANSI string, unless the code page is 1200 (Unicode). If pwszText starts with a valid RTF ASCII sequence for example, "{\rtf" or "{urtf" the text is read in using the RTF reader.

Return value

If the operation is setting all of the text and succeeds, the return value is 1.

If the operation is setting the selection and succeeds, the return value is the number of bytes or characters copied.

If the operation fails, the return value is zero.

Description

Sets the text of an edit control. Combines the functionality of the WM_SETTEXT and EM_REPLACESEL messages, and adds the ability to set text using a code page and to use either rich text or plain text.

Reference

  • Defined in AfxNova/CRichEdit.inc:1231
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class