getRootElementBuildCache method
Retrieves the UI Automation element that represents 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-getrootelementbuildcache.
Implementation
IUIAutomationElement? getRootElementBuildCache(
IUIAutomationCacheRequest? cacheRequest,
) {
final root = adaptiveCalloc<VTablePointer>();
final hr$ = HRESULT(
_GetRootElementBuildCacheFn(ptr, cacheRequest?.ptr ?? nullptr, root),
);
if (hr$.isError) {
free(root);
throw WindowsException(hr$);
}
final result$ = root.value;
free(root);
if (result$.isNull) return null;
return .new(result$);
}