IUIAutomationTextPattern::GetSelection Method

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

Syntax

HRESULT GetSelection(      
    IUIAutomationTextRangeArray **ranges
);

Parameters

  • ranges
    [out, retval] The address of a variable that receives a pointer to the IUIAutomationTextRangeArray interface for the collection of disjoint text ranges.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

If no text is selected, the method returns the degenerate (empty) text range at the position of the system cursor (text insertion point).

If the text insertion point is not present, ranges might return NULL.

Use the IUIAutomationTextPattern::SupportedTextSelection property to test whether text selection or positioning of the text insertion point is supported by the control.