ITfContext::SetSelection method (msctf.h)

Sets the selection within the document.

Syntax

HRESULT SetSelection(
  [in] TfEditCookie       ec,
  [in] ULONG              ulCount,
  [in] const TF_SELECTION *pSelection
);

Parameters

[in] ec

Contains an edit cookie that identifies the edit session. This is the value passed to ITfEditSession::DoEditSession.

[in] ulCount

Specifies the number of selections in the pSelection array.

[in] pSelection

An array of TF_SELECTION structures that contain the information for each selection.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
TF_E_NOSELECTION
The document has no selection.
TF_E_NOLOCK
The cookie in ec is invalid.

Remarks

A selection is a span of highlighted text, or an insertion point if the span is empty, identifying the user focus area within a document. Some documents are capable of having multiple selections. There can only be one zero-length selection in pSelection as it represents the position of the document caret.

If an application must adjust the text covered by a selection, it should wait until the caller releases the lock. However, applications can adjust any of the style members of the TF_SELECTION structures while still returning S_OK.

The caller can set the fInterimChar flag only if one selection is set. In this case, the selection should span exactly one character and the ase member of the TF_SELECTION structure is set to TFAE_NONE.

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

ITfContext interface, ITfEditSession::DoEditSession, TF_SELECTION structure, ITfContext::GetSelection