ITextRangeProvider::GetText method (uiautomationcore.h)

Retrieves the plain text of the range.

Syntax

HRESULT GetText(
  [in]          int  maxLength,
  [out, retval] BSTR *pRetVal
);

Parameters

[in] maxLength

Type: int

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

[out, retval] 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

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

Conceptual

ITextProvider

ITextRangeProvider

Reference

UI Automation Providers Overview