getCachedParent method

IUIAutomationElement? getCachedParent()

Retrieves from the cache the parent of this UI Automation element.

Throws a WindowsException on failure.

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

Implementation

IUIAutomationElement? getCachedParent() {
  final parent = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(_GetCachedParentFn(ptr, parent));
  if (hr$.isError) {
    free(parent);
    throw WindowsException(hr$);
  }
  final result$ = parent.value;
  free(parent);
  if (result$.isNull) return null;
  return .new(result$);
}