3 releases
0.1.2 | Feb 7, 2023 |
---|---|
0.1.1 | Jan 5, 2023 |
0.1.0 | Jan 5, 2023 |
#519 in GUI
22KB
350 lines
win-msgbox
This crate provides a fully featured, ergonomic interface to Windows' MessageBox
.
All possible options are usable and return values are Rust enums (or structs if only one option is available).
All configuration is done through MessageBox
and available buttons are configured via Options
.
This crate uses wide strings. To create a wide string use the w!
macro from windows
or windows_sys
.
Examples
Show a minimal message box with an OK button:
win_msgbox::show::<Okay>(w!("Hello World"));
Show a message box with an error icon, and match on the return value:
use CancelTryAgainContinue::*;
let response = win_msgbox::error::<CancelTryAgainContinue>(w!("Couldn't download resource"))
.title(w!("Download Error"))
.show()?;
match response {
Cancel => println!("Cancelling downlaod..."),
TryAgain => println!("Attempting redownload..."),
Continue => println!("Skipping resource"),
}
For more examples, take a look at the examples
directory.
Dependencies
~28MB
~449K SLoC