Share via


IUIAutomationCacheRequest::AutomationElementMode Property

Gets or sets a value that specifies whether returned elements should contain full references to the underlying user interface (UI), or only cached information.

Syntax

HRESULT IUIAutomationCacheRequest::get_AutomationElementMode(AutomationElementMode *pMode);
HRESULT IUIAutomationCacheRequest::put_AutomationElementMode(AutomationElementMode mode);

Parameters

  • pMode
    The address of a variable that receives a value from the AutomationElementMode enumerated type indicating the type of reference being used.
  • mode
    A value from the AutomationElementMode enumerated type specifying the type of reference to use.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

AutomationElementMode_Full is the default value, and specifies that returned elements contain a full reference to the underlying UI. AutomationElementMode_None specifies that the returned elements have no reference to the underlying UI, and contain only cached information.

Certain operations on elements, including IUIAutomationElement::GetCurrentPropertyValue, and IUIAutomationElement::SetFocus, require a full reference; attempting to perform these on an element that has none results in an error.

Using AutomationElementMode_None can be more efficient when only properties are needed, as it avoids the overhead involved in setting up full references.