getPreviousSiblingElementBuildCache method

IUIAutomationElement? getPreviousSiblingElementBuildCache(
  1. IUIAutomationElement? element,
  2. IUIAutomationCacheRequest? cacheRequest
)

Retrieves the previous sibling element of the specified UI Automation element, and caches properties and control patterns.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtreewalker-getprevioussiblingelementbuildcache.

Implementation

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