ITextStoreAnchor::GetSelection method (textstor.h)

The ITextStoreAnchor::GetSelection method returns the offset of a text selection in a text stream. This method supports multiple text selections. The caller must have a read-only lock on the document before calling this method.

Syntax

HRESULT GetSelection(
  [in] ULONG                     ulIndex,
  [in] ULONG                     ulCount,
  [out] TS_SELECTION_ANCHOR       *pSelection,
  [out] ULONG                     *pcFetched
);

Parameters

[in] ulIndex

Specifies the text selections that start the process. If the TF_DEFAULT_SELECTION constant is specified for this parameter, the input selection starts the process, and only a single selection (the one appropriate for input operations) will be returned.

[in] ulCount

Specifies the maximum number of selections to return.

[out] pSelection

Receives the style, start, and end character positions of the selected text. These values are put into the TS_SELECTION_ANCHOR structure.

[out] pcFetched

Receives the number of pSelection structures returned.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_FAIL
The method was unable to load the start or end anchor into the TS_SELECTION_ANCHOR structure.
E_OUTOFMEMORY
The method was unable to allocate memory for the selection.
TS_E_NOLOCK
The caller does not have a read-only lock on the document.
TS_E_NOSELECTION
The document has no selection.

Requirements

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

See also

Edit Contexts

ITextStoreAnchor

ITextStoreAnchor::SetSelection

Miscellaneous Framework Constants

TF_DEFAULT_SELECTION

TS_SELECTION_ANCHOR