ITextProvider::GetSelection Method

Retrieves a collection of disjoint text ranges associated with the current text selection or selections.


HRESULT GetSelection(          SAFEARRAY **pRetVal


[out, retval] The address of a variable that receives an array of pointers to the ITextRangeProvider interfaces of the text ranges, or NULL if no text is selected or there is no insertion point. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.


For UI Automation providers that support text selection, the provider should implement this method and also return a ITextProvider::SupportedTextSelection value.

If no text is selected, ITextProvider::GetSelection returns the degenerate text range (empty range) at the position where the system cursor (text insertion point) exists.

If the system cursor is not present, ITextProvider::GetSelection may return a null reference (Nothing in Microsoft Visual Basic .NET).

See Also

Community Additions