[This is preliminary documentation and subject to change.]
Rich Edit 2.0 and later: Send an EM_SETTEXTMODE message to set the text mode or undo level of a rich edit control. The message fails if the control contains any text.
Rich Edit 1.0: This message is not supported.
EM_GETUNDONAME 
wParam = (WPARAM) mode;    // specifies the new text mode 
lParam = 0 ;               // not used;  must be zero 
 
Specify one of the following values to set the text mode parameter. If you don't specify a text mode value, the text mode remains at its current setting.
| Value | Meaning | 
|---|---|
| TM_PLAINTEXT | Indicates plain text mode, in which the control is similar to a standard edit control. For more information about plain text mode, see the following Remarks section. | 
| TM_RICHTEXT | Indicates rich text mode, in which the control has standard rich edit functionality. Rich text mode is the default setting. | 
Specify one of the following values to set the undo level parameter. If you don't specify an undo level value, the undo level remains at its current setting.
| Value | Meaning | 
|---|---|
| TM_SINGLELEVELUNDO | The control allows the user to undo only the last action that can be undone. | 
| TM_MULTILEVELUNDO | The control supports multiple undo operations. This is the default setting. Use the EM_SETUNDOLIMIT message to set the maximum number of undo actions. | 
The TM_SINGLECODEPAGE and TM_MULTICODEPAGE values are not currently supported.
If the message succeeds, the return value is zero.
If the message fails, the return value is nonzero.
In rich text mode, a rich edit control has standard rich edit functionality. However, in plain text mode, the control is similar to a standard edit control.
The control must contain no text when it receives the EM_SETTEXTMODE message. To ensure there is no text, send a WM_SETTEXT message with an empty string ("").
  Windows NT: Requires version 4.0 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in richedit.h.
Rich Edit Controls Overview, Rich Edit Messages, EM_GETTEXTMODE, TEXTMODE, WM_SETTEXT