ITfRange::Collapse method (msctf.h)

The ITfRange::Collapse method clears the range of text by moving its start anchor and end anchor to the same position.

Syntax

HRESULT Collapse(
  [in] TfEditCookie ec,
  [in] TfAnchor     aPos
);

Parameters

[in] ec

Edit cookie obtained from ITfDocumentMgr::CreateContext or ITfEditSession::DoEditSession.

[in] aPos

TfAnchor enumeration that describes how to collapse the range.

Value Meaning
TF_ANCHOR_START
The end anchor is moved to the location of the start anchor.
TF_ANCHOR_END
The start anchor is moved to the location of the end anchor.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_FAIL
The object does not support the interface, or a new range cannot be created.
E_INVALIDARG
aPos is invalid.
TF_E_NOLOCK
The cookie in ec is invalid, or the caller does not have a read-only lock.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header msctf.h
DLL Msctf.dll
Redistributable TSF 1.0 on Windows 2000 Professional

See also

ITfDocumentMgr::CreateContext

ITfEditSession::DoEditSession

ITfRange

Text Stores

TfAnchor