errorCode property

int get errorCode

Implementation

int get errorCode {
  final retValuePtr = calloc<Int32>();

  try {
    final hr = ptr.ref.vtable
        .elementAt(8)
        .cast<
            Pointer<
                NativeFunction<
                    HRESULT Function(
                        VTablePointer lpVtbl, Pointer<Int32> retValuePtr)>>>()
        .value
        .asFunction<
            int Function(VTablePointer lpVtbl,
                Pointer<Int32> retValuePtr)>()(ptr.ref.lpVtbl, retValuePtr);

    if (FAILED(hr)) throwWindowsException(hr);

    return retValuePtr.value;
  } finally {
    free(retValuePtr);
  }
}