MSDN Home >  MSDN Library >  User Interface Design and Development >  Windows Controls >  Individual Control Information >  Rich Edit Controls > 

EM_SETTEXTEX Message


The EM_SETTEXTEX message 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.

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage(     // returns LRESULT in lResult
   (HWND) hWndControl,     // handle to destination control
   (UINT) EM_SETTEXTEX,     // message ID
   (WPARAM) wParam,     // = (WPARAM) () wParam;
   (LPARAM) lParam     // = (LPARAM) () lParam;
);

Parameters

wParam
Pointer to a SETTEXTEX structure that specifies flags and an optional code page to use in translating to Unicode.
lParam
Pointer to the null-terminated text to insert. This text is an ANSI string, unless the code page is 1200 (Unicode), in which case it's a Unicode string. If lParam starts with a valid RTF ASCII sequence, for example, {\rtf or {urtf, the text is read in using the RTF reader. This allows one to set rich text.

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.


Message Information

HeaderDeclared in Richedit.h
Minimum operating systems Windows 95 with Rich Edit 3.0, Windows NT 4.0 with Rich Edit 3.0, Windows Millenium Edition, Windows 2000

See Also

Rich Edit Controls, EM_GETTEXTEX, SETTEXTEX
 Contact Us   |  E-Mail this Page   |  MSDN Flash Newsletter
 c 2002 Microsoft Corporation. All rights reserved.   Terms of Use  Privacy Statement   Accessibility