win_msgbox
A small Rust library for native Windows message boxes and notification popups.
Features
- Native Win32 message boxes with icon and button presets
- Optional auto-close timeout for message boxes
- Standalone popup notification window (bottom-right corner)
- Balloon tip helper for existing tray icons
Platform
- Windows only
- Uses raw Win32 FFI (User32, Shell32, Gdi32)
Installation
Add to your Cargo.toml:
[]
= "1.1.0"
Quick Start
use ;
API Overview
Message Boxes
info_msgbox(msg, title, timeout_ms) -> i32error_msgbox(msg, title, timeout_ms) -> i32warn_msgbox(msg, title, timeout_ms) -> i32quest_msgbox_yesno(msg, title, timeout_ms) -> i32quest_msgbox_okcancel(msg, title, timeout_ms) -> i32
Return values follow Win32 MessageBox conventions:
1: OK2: Cancel6: Yes7: No-1: closed by timeout
Standalone Notification Popup
notify_msgbox_standalone(title, msg, timeout_ms) -> boolwait_notifications()
Tray Balloon Helper
notify_msgbox(hwnd, msg, icon_id) -> i32
Notes:
notify_msgboxrequires an existing tray icon created with the sameicon_id.NotifyIconTypeenum is exported for future extension.
Publish to crates.io
-
Create a crates.io account and API token.
-
Log in from terminal:
cargo login <YOUR_CRATES_IO_TOKEN> -
Validate package locally:
cargo fmt --check cargo clippy -- -D warnings cargo package -
Publish:
cargo publish -
Verify:
cargo search win_msgbox
Notes Before Publishing
- Ensure the version in
Cargo.tomlis new (cannot republish same version). - Make sure
license,description, andreadmeare present. - Consider adding
repositorywhen you have a public Git repository URL.
License
MIT