Expand description
§WinDialog
Provides an idiomatic Rust interface on top of Window’s Message Box api.
§Overview
Window’s Message Box api allows you to get input from the user in the form of a set of fixed options displayed as buttons on a simple dialog box. It allows custom header text, body text, and allows a choice of icons, among a few other settings. The windows crate exposes a typesafe interface, but it just a thin wrapper around the raw C-api.
This crate provides a further layer on top of this C-wrapper to make interacting with it feel more like native Rust.
§Usage
§Simple Example:
use win_dialog::{style, Icon, WinDialog};
use windows::Win32::Foundation::HWND;
let res =
WinDialog::new("We encountered an error during installation. What would you like to do?")
.with_header("Installation error")
.with_style(style::AbortRetryIgnore)
.with_icon(Icon::Warning)
.show()
.unwrap();
println!("{res:?}");
Modules§
- style
- Traits and marker structs modeling the different styles of dialog box.
Structs§
- WinDialog
- A builder struct used for configuring a MessageBox. Uses the MessageBoxA function under the hood.
- WinDialog
With Parent - A Message Box with an attached parent window.
Enums§
- Error
- The possible errors that could occur when showing the message box.
- Icon
- Represents the set of icons available for a message box.
- Modality
- Indicate the modality of the dialog box.
Type Aliases§
- Result
- Custom error type alias for the crate.