Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ITextStoreACP2::SetText method

Sets the text selection to the supplied character positions.

Syntax


HRESULT SetText(
  [in]                     DWORD         dwFlags,
  [in]                     LONG          acpStart,
  [in]                     LONG          acpEnd,
  [in, size_is(cch)] const WCHAR         *pchText,
  [in]                     ULONG         cch,
  [out]                    TS_TEXTCHANGE *pChange
);

Parameters

dwFlags [in]

If set to the value of TS_ST_CORRECTION, the text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, such as .wav file data or a language identifier. The client defines the type of markup information to be retained.

acpStart [in]

Specifies the starting character position of the text to replace.

acpEnd [in]

Specifies the ending character position of the text to replace. This parameter is ignored if the value is 1.

pchText [in]

Specifies the pointer to the replacement text. The text string does not have to be NULL terminated, because the text character count is specified in the cch parameter.

cch [in]

Specifies the number of characters in the replacement text.

pChange [out]

Pointer to a TS_TEXTCHANGE structure with the following data.

ValueMeaning
acpStart

The starting application character position before the text is inserted into the document.

acpOldEnd

The ending position before the text is inserted into the document. This value is the same as acpStart for an insertion point. If this value is different from acpStart, then text was selected prior to the text insertion.

acpNewEnd

The ending position after the text insertion occurred.

 

Return value

This method can return one of these values.

ValueDescription
S_OK

The method was successful.

TS_E_INVALIDPOS

The acpStart or acpEnd parameter is outside of the document text.

TS_E_NOLOCK

The caller does not have a read/write lock.

TS_E_READONLY

The document is read-only. Content cannot be modified.

TS_E_REGION

An attempt was made to modify text across a region boundary.

 

Remarks

Applications should start a composition by first using InsertTextAtSelection. SetText should be used only within an existing composition. If there is no active composition at the time SetText is called, the TSF manager creates a composition that lasts just long enough to wrap the call to SetText.

The acpStart and acpEnd character positions cannot be outside the document range.

Applications should not call the OnTextChange method in response to this method.

This method should call the SetSelection method to select the text to be changed. After successfully executing the SetSelection method, this method then calls the InsertTextAtSelection method to perform the actual text change.

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

Textstor.h

IDL

Textstor.idl

DLL

Msctf.dll

See also

ITextStoreACP2
OnTextChange
TS_TEXTCHANGE
Miscellaneous Text Store Constants
Compositions

 

 

Show:
© 2016 Microsoft