ITextRangeProvider::GetEnclosingElement method (uiautomationcore.h)

Returns the innermost element that encloses the specified text range.

Syntax

HRESULT GetEnclosingElement(
  [out, retval] IRawElementProviderSimple **pRetVal
);

Parameters

[out, retval] pRetVal

Type: IRawElementProviderSimple**

The UI Automation provider of the innermost element that encloses the specified ITextRangeProvider.

Note

The enclosing element can span more than just the specified ITextRangeProvider.

If no enclosing element is found, the ITextProvider parent of the ITextRangeProvider is 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

Examples

  1. This example shows a text stream that contains an image link. The link is a child of the image, but both span the same text range and are exposed as embedded objects within the text stream.

    Hello <Image Link> World

  2. This example shows a text stream that contains a two-cell table surrounded by text.

    Start text

    Table Cell 1Table Cell 2

    End Text

Requirements

Requirement Value
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

ITextProvider, ITextRangeProvider, ITextRangeProvider::GetChildren, UI Automation Providers Overview