ITextRangeProvider::GetText method

Retrieves the plain text of the range.

Syntax

HRESULT GetText(
  int  maxLength,
  BSTR *pRetVal
);

Parameters

maxLength

Type: int

The maximum length of the string to return. Use -1 if no limit is required.

pRetVal

Type: BSTR*

Receives the plain text of the text range, possibly truncated at the specified maximum length. 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

ITextRangeProvider::GetText retrieves both hidden and visible text.

If maxLength is greater than the length of the text span of the caller, the string returned will be the plain text of the text range.

ITextRangeProvider::GetText will not be affected by the order of endpoints in the text flow; it will always return the text between the start and end endpoints of the text range in the logical text flow order.

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

Conceptual

ITextProvider

ITextRangeProvider

Reference

UI Automation Providers Overview