ITextProvider::GetVisibleRanges method

Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text.

Syntax

HRESULT GetVisibleRanges(
  SAFEARRAY **pRetVal
);

Parameters

pRetVal

Type: SAFEARRAY**

Receives the address of an array of pointers to the ITextRangeProvider interfaces of the visible text ranges or an empty array. A NULL reference is never returned. This parameter is passed uninitialized.

Return Value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If the visible text consists of one contiguous span of text, the pRetVal array should contain a single text range that represents all of the visible text.

If the visible text consists of multiple, disjoint spans of text, the pRetVal array should contain one text range for each visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a text-based control with multiple pages or columns has content that is partially scrolled out of view.

ITextProvider::GetVisibleRanges should return a degenerate (empty) text range if no text is visible, if all text is scrolled out of view, or if the text-based control contains no text.

Requirements

   
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header uiautomationcore.h (include UIAutomation.h)

See Also

Best Practices for Using Safe Arrays

Conceptual

ITextProvider

ITextRangeProvider

Reference

UI Automation Providers Overview