ITextServices::TxSetText method (textserv.h)

Sets all of the text in the control.

Syntax

HRESULT TxSetText(
  [in] LPCWSTR pszText
);

Parameters

[in] pszText

Type: LPCTSTR

The string which will replace the current text.

Return value

Type: HRESULT

If the method succeeds, the return value is S_OK.

If the method fails, the return value is the following HRESULT code. For more information on COM error codes, see Error Handling in COM.

Return code Description
E_FAIL
Text could not be updated.

Remarks

This method should be used with care; it essentially reinitializes the text services object with some new data. Any previous data and formatting information will be lost, including undo information.

If previous data has been copied to the clipboard, that data will be rendered completely to the clipboard (through OleFlushClipboard) before it is discarded.

This method does not support Undo.

Two alternate approaches to setting text are WM_SETTEXT and SetText.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header textserv.h
DLL Msftedit.dll

See also

Conceptual

ITextServices

OleFlushClipboard

Other Resources

Reference

SetText

WM_SETTEXT

Windowless Rich Edit Controls