int messageBox()

in ffi/system-command/win32ui.dart [52:71]


int messageBox(String message, String caption) {
  // Load user32.
  final user32 = DynamicLibrary.open('user32.dll');

  // Look up the `MessageBoxW` function.
  final messageBoxP =
      user32.lookupFunction<MessageBoxC, MessageBoxDart>('MessageBoxW');

  // Allocate pointers to Utf16 arrays containing the command arguments.
  final messageP = message.toNativeUtf16();
  final captionP = caption.toNativeUtf16();

  // Invoke the command, and free the pointers.
  final result =
      messageBoxP(nullptr, messageP, captionP, MB_OK | MB_ICONINFORMATION);
  calloc.free(messageP);
  calloc.free(captionP);

  return result;
}