win_dialog

Crates.iowin_dialog
lib.rswin_dialog
version1.0.1
sourcesrc
created_at2024-05-27 23:05:21.501513
updated_at2024-06-02 23:04:56.685826
descriptionAn idiomatic wrapper around windows MessageBox function for providing message dialogs in Windows.
homepage
repositoryhttps://github.com/toadslop/win-dialog
max_upload_size
id1253840
size51,988
Brian (toadslop)

documentation

README

Win-Dialog

An idiomatic Rust interface for the Windows message box API.

Motivation

One can simply use the windows crate to invoke this api, but the api is a rather old-fashioned C-style API, so its rather unintuitive for a Rust developer without C programming experience to use. This create wraps the raw API with a familiar interface and provides more complete documentation about how to use it than the official crate documentation does.

Message Box Appearance

A Windows message box looks like this:

example message box

You have the ability to make the following changes:

  • Change the header (or display a default header)
  • Change the body text
  • Choose the available buttons from among a fixed set. You cannot edit button text
  • Change the icon (or display no icon)

Usage

use win_dialog::{style, Icon, WinDialog};

fn main() {
    let res =
        WinDialog::new("We encountered an error during installation. What would you like to do?")
            .with_style(style::AbortRetryIgnore)
            .with_icon(Icon::Hand)
            .show()
            .unwrap();
    println!("{res:?}");
}

Possible Future Features

  • Dialog timeouts
  • Async interface
Commit count: 43

cargo fmt