Share via


ITextRangeProvider::GetText Method

Retrieves the plain text of the range.

Syntax

HRESULT GetText(      
    int maxLength,
    BSTR *pRetVal
);

Parameters

  • maxLength
    [in] The maximum length of the string to return. Use -1 if no limit is required.
  • pRetVal
    [out, retval] The address of a BSTR that receives the plain text of the text range, possibly truncated at the specified maximum length. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.

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.

See Also

UI Automation Providers Overview, ITextProvider