elementFromIAccessible method
Retrieves a UI Automation element for the specified accessible object from a Microsoft Active Accessibility server.
Throws a WindowsException on failure.
To learn more, see learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomation-elementfromiaccessible.
Implementation
IUIAutomationElement? elementFromIAccessible(
IAccessible? accessible,
int childId,
) {
final element = adaptiveCalloc<VTablePointer>();
final hr$ = HRESULT(
_ElementFromIAccessibleFn(
ptr,
accessible?.ptr ?? nullptr,
childId,
element,
),
);
if (hr$.isError) {
free(element);
throw WindowsException(hr$);
}
final result$ = element.value;
free(element);
if (result$.isNull) return null;
return .new(result$);
}