Windows Dev Center

Expand Minimize

IUIAutomationElement::FindFirstBuildCache method

Retrieves the first child or descendant element that matches the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

Syntax


HRESULT FindFirstBuildCache(
  [in]          TreeScope                 scope,
  [in]          IUIAutomationCondition    *condition,
  [in]          IUIAutomationCacheRequest *cacheRequest,
  [out, retval] IUIAutomationElement      **found
);

Parameters

scope [in]

Type: TreeScope

A combination of values specifying the scope of the search.

condition [in]

Type: IUIAutomationCondition*

A pointer to a condition that represents the criteria to match.

cacheRequest [in]

Type: IUIAutomationCacheRequest*

A pointer to a cache request that specifies the control patterns and properties to include in the cache.

found [out, retval]

Type: IUIAutomationElement**

Receives a pointer to the matching element, or NULL if no matching element is found.

Return value

Type: HRESULT

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

Remarks

The scope of the search is relative to the element on which the method is called. Elements are returned in the order in which they were encountered in the tree.

This function cannot search for ancestor elements in the Microsoft UI Automation tree; that is, TreeScope_Ancestors is not a valid value for the scope parameter.

When searching for top-level windows on the desktop, be sure to specify TreeScope_Children in the scope parameter, not TreeScope_Descendants. A search through the entire subtree of the desktop could iterate through thousands of items and lead to a stack overflow.

If your client application might try to find elements in its own user interface, you must make all UI Automation calls on a separate thread.

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]

Header

UIAutomationClient.h (include UIAutomation.h)

IDL

UIAutomationClient.idl

See also

Reference
IUIAutomationElement
FindAll
FindAllBuildCache
FindFirst
Conceptual
Caching UI Automation Properties and Control Patterns
Obtaining UI Automation Elements

 

 

Community Additions

ADD
Show:
© 2015 Microsoft