Skip to content

Windows port #3

@59de44955ebd

Description

@59de44955ebd

Hi, for anyone interested, here a minimal port to Windows:

// index.js
import koffi from 'koffi';
const lib = koffi.load('user32.dll');
const MessageBoxW = lib.func('__stdcall', 'MessageBoxW', 'int', ['void *', 'str16', 'str16', 'uint']);
const MB_OK = 0x0;
const MB_ICONERROR = 0x10;
export default function errorDialog(error, title) {
	error = error.stack || error;
	title = title || '';
	MessageBoxW(null, error, title, MB_OK | MB_ICONERROR);
}

Usage:

// demo.mjs
import errorDialog from 'error-dialog';
const error = new Error('Expected more unicorns!');
errorDialog(error, '🦄');

Result:
error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions