ITextProvider::RangeFromChild Method

Retrieves a text range enclosing a child element such as an image, hyperlink, or other embedded object.

Syntax

HRESULT RangeFromChild(      
    IRawElementProviderSimple *childElement,
    ITextRangeProvider **pRetVal
);

Parameters

  • childElement
    [in] The address of the IRawElementProviderSimple interface for the enclosed Microsoft UI Automation object.
  • pRetVal
    [out, retval] The address of a variable that receives a pointer to the ITextRangeProvider interface of the text range that spans the child element. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

A provider should check that the passed element is a child of the text container.

If there is no text in the text range where the child element exists, a degenerate (empty) range is returned.

The childElement parameter is either a child of the UI Automation element associated with a TextPattern or from the array of children of an ITextRangeProvider.

See Also

UI Automation Providers Overview, ITextRangeProvider