IUIAutomationElement::FindAllBuildCache 方法 (uiautomationclient.h)

傳回滿足指定條件的所有 UI 自動化元素、預先擷取要求的屬性和控制模式,並將預先擷取的專案儲存在快取中。

語法

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

參數

scope

[in] condition

類型: IUIAutomationCondition*

條件的指標,表示要比對的準則。

[in] cacheRequest

類型: IUIAutomationCacheRequest*

快取要求的指標,指定要包含在快取中的控制項模式和屬性。

[out, retval] found

類型: IUIAutomationElementArray**

接收相符專案的陣列指標。 如果沒有相符專案,則會傳回 Null

傳回值

類型: HRESULT

如果此方法成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。

備註

搜尋的範圍相對於呼叫 方法的專案。 元素會依照樹狀結構中遇到的順序傳回。

此函式無法搜尋 Microsoft UI 自動化樹狀目錄中的上階元素;也就是說, TreeScope_Ancestors 不是 範圍 參數的有效值。

在桌面上搜尋最上層視窗時,請務必在scope參數中指定TreeScope_Children,而不是TreeScope_Descendants。 透過桌面整個子樹的搜尋可能會逐一查看數千個專案,並導致堆疊溢位。

如果您的用戶端應用程式可能嘗試在自己的使用者介面中尋找元素,您必須在個別的執行緒上呼叫所有 UI 自動化呼叫。

需求

   
最低支援的用戶端 Windows 7、Windows Vista sp2 和 Platform Update for Windows Vista、Windows XP with SP3 和 Platform Update for Windows Vista [僅限桌面應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008、Windows Server 2003 SP2 和 Platform Update for Windows Server 2008 [僅限桌面應用程式]
目標平台 Windows
標頭 uiautomationclient.h (包含 UIAutomation.h)

另請參閱

快取 UI 自動化屬性和控制模式

概念

FindAll

FindFirst

FindFirstBuildCache

IUIAutomationElement

取得 UI 自動化項目

參考