elementFromPointBuildCache method

IUIAutomationElement? elementFromPointBuildCache(
  1. POINT pt,
  2. IUIAutomationCacheRequest? cacheRequest
)

Retrieves the UI Automation element at the specified point on the desktop, 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-iuiautomation-elementfrompointbuildcache.

Implementation

IUIAutomationElement? elementFromPointBuildCache(
  POINT pt,
  IUIAutomationCacheRequest? cacheRequest,
) {
  final element = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(
    _ElementFromPointBuildCacheFn(
      ptr,
      pt,
      cacheRequest?.ptr ?? nullptr,
      element,
    ),
  );
  if (hr$.isError) {
    free(element);
    throw WindowsException(hr$);
  }
  final result$ = element.value;
  free(element);
  if (result$.isNull) return null;
  return .new(result$);
}