Skip to content

Latest commit

 

History

History
137 lines (102 loc) · 3.64 KB

nf-tom-itextrange-settext.md

File metadata and controls

137 lines (102 loc) · 3.64 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:tom.ITextRange.SetText
ITextRange::SetText (tom.h)
Sets the text in this range.
ITextRange interface [Windows Controls]
SetText method
ITextRange.SetText
ITextRange::SetText
SetText
SetText method [Windows Controls]
SetText method [Windows Controls]
ITextRange interface
_win32_ITextRange_SetText
_win32_ITextRange_SetText_cpp
controls.ITextRange_SetText
controls._win32_ITextRange_SetText
tom/ITextRange::SetText
controls\ITextRange_SetText.htm
Controls
VS|Controls|~\controls\richedit\textobjectmodel\textobjectmodelreference\textobjectmodelinterfaces\settext.htm
12/05/2018
ITextRange interface [Windows Controls],SetText method, ITextRange.SetText, ITextRange::SetText, SetText, SetText method [Windows Controls], SetText method [Windows Controls],ITextRange interface, _win32_ITextRange_SetText, _win32_ITextRange_SetText_cpp, controls.ITextRange_SetText, controls._win32_ITextRange_SetText, tom/ITextRange::SetText
tom.h
Windows
Windows Vista [desktop apps only]
Windows Server 2003 [desktop apps only]
Msftedit.dll
Windows
19H1
ITextRange::SetText
tom/ITextRange::SetText
c++
APIRef
kbSyntax
COM
Msftedit.dll
ITextRange.SetText

ITextRange::SetText

-description

Sets the text in this range.

-parameters

-param bstr [in]

Type: BSTR

Text that replaces the current text in this range. If null, the current text is deleted.

-returns

Type: HRESULT

The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.

Return code Description
E_ACCESSDENIED
Text is write-protected.
E_INVALIDARG
bstr is null.
E_OUTOFMEMORY
Out of memory.

-remarks

ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed the text in. For UI selection behavior, see TypeText.

If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the ITextRange::SetText method (unless some other range has changed that text in between the calls).

-see-also

Conceptual

GetText

ITextRange

Reference

Text Object Model

TypeText