IUIAutomationTextRange::FindAttribute method

Retrieves a text range subset that has the specified text attribute value.

Syntax

HRESULT FindAttribute(
  TEXTATTRIBUTEID        attr,
  VARIANT                val,
  BOOL                   backward,
  IUIAutomationTextRange **found
);

Parameters

attr

Type: TEXTATTRIBUTEID

The identifier of the text attribute for the text range subset being retrieved. For a list of text attribute IDs, see Text Attribute Identifiers.

val

Type: VARIANT

The value of the attribute. This value must match the type specified for the attribute.

backward

Type: BOOL

TRUE if the last occurring text range should be returned instead of the first; otherwise FALSE.

found

Type: IUIAutomationTextRange**

Receives a pointer to the text range having a matching attribute and attribute value; otherwise NULL.

Return Value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The FindAttribute method retrieves matching text regardless of whether the text is hidden or visible. Use UIA_IsHiddenAttributeId to check text visibility.

Requirements

   
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista, Windows XP with SP3 and Platform Update for Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008, Windows Server 2003 with SP2 and Platform Update for Windows Server 2008 [desktop apps only]
Target Platform Windows
Header uiautomationclient.h (include UIAutomation.h)

See Also

IUIAutomationTextRange

UI Automation Support for Textual Content