add_StatusChanged method

int add_StatusChanged(
  1. Pointer<NativeFunction<TypedEventHandler>> handler
)

Implementation

int add_StatusChanged(Pointer<NativeFunction<TypedEventHandler>> handler) {
  final retValuePtr = calloc<IntPtr>();

  try {
    final hr = ptr.ref.vtable
        .elementAt(17)
        .cast<
            Pointer<
                NativeFunction<
                    HRESULT Function(
                        Pointer,
                        Pointer<NativeFunction<TypedEventHandler>> handler,
                        Pointer<IntPtr>)>>>()
        .value
        .asFunction<
            int Function(
                Pointer,
                Pointer<NativeFunction<TypedEventHandler>> handler,
                Pointer<IntPtr>)>()(ptr.ref.lpVtbl, handler, retValuePtr);

    if (FAILED(hr)) throw WindowsException(hr);

    final retValue = retValuePtr.value;
    return retValue;
  } finally {
    free(retValuePtr);
  }
}