createToastNotifierWithId method

Pointer<COMObject> createToastNotifierWithId(
  1. String applicationId
)

Implementation

Pointer<COMObject> createToastNotifierWithId(String applicationId) {
  final retValuePtr = calloc<COMObject>();
  final applicationIdHstring = convertToHString(applicationId);
  final hr = ptr.ref.vtable
          .elementAt(7)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(Pointer, IntPtr applicationId,
                          Pointer<COMObject>)>>>()
          .value
          .asFunction<
              int Function(Pointer, int applicationId, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, applicationIdHstring, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }
  WindowsDeleteString(applicationIdHstring);
  return retValuePtr;
}