findAllBuildCache method

IUIAutomationElementArray? findAllBuildCache(
  1. TreeScope scope,
  2. IUIAutomationCondition? condition,
  3. IUIAutomationCacheRequest? cacheRequest
)

Returns all UI Automation elements that satisfy the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-findallbuildcache.

Implementation

IUIAutomationElementArray? findAllBuildCache(
  TreeScope scope,
  IUIAutomationCondition? condition,
  IUIAutomationCacheRequest? cacheRequest,
) {
  final found = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(
    _FindAllBuildCacheFn(
      ptr,
      scope,
      condition?.ptr ?? nullptr,
      cacheRequest?.ptr ?? nullptr,
      found,
    ),
  );
  if (hr$.isError) {
    free(found);
    throw WindowsException(hr$);
  }
  final result$ = found.value;
  free(found);
  if (result$.isNull) return null;
  return .new(result$);
}