Skip to main content

Crate win_msgbox_timeout

Crate win_msgbox_timeout 

Source
Expand description

Windows message box and notification module.

This crate provides utility functions for displaying native Windows message boxes and system notifications with support for auto-close timeout, multiple icon styles, and various button combinations.

§Features

  • Message boxes: Native Win32 message boxes with icon and button presets, plus optional auto-close timeout.
  • Standalone popup notification: A custom popup window in the bottom-right corner with live countdown display.
  • Tray balloon helper: Display balloon notifications on existing system tray icons.
  • C/C++ FFI: Expose custom_msgbox_w for direct calling from C/C++ code (requires cdylib crate type).

§Quick Start

use win_msgbox_timeout::{
    MsgBoxType, MsgBtnType, custom_msgbox, error_msgbox, info_msgbox,
    quest_msgbox_yesno, warn_msgbox,
};

// Simple info dialog
info_msgbox("Hello from Rust", "Info", 0);

// Warning with 3-second auto-close
warn_msgbox("Careful!", "Warning", 3000);

// Yes/No question
let result = quest_msgbox_yesno("Do you want to continue?", "Question", 0);
if result == 6 {
    info_msgbox("You clicked Yes", "Result", 0);
}

§C/C++ Interop

When built with crate-type = ["cdylib"], the crate exports custom_msgbox_w as a C-compatible function. See the custom_msgbox_w documentation for details.

Enums§

MsgBoxType
Icon styles for Windows message boxes.
MsgBtnType
Button combinations for Windows message boxes.
NotifyIconType
Icon types for system tray balloon notifications.

Functions§

custom_msgbox
Displays a custom Windows message box.
custom_msgbox_w
Displays a custom Windows message box from C or C++ code.
error_msgbox
Displays an error message box.
info_msgbox
Displays an information message box.
notify_msgbox
Displays a balloon tip notification on an existing system tray icon.
notify_msgbox_standalone
Displays a standalone notification window in the bottom-right corner of the screen.
quest_msgbox_okcancel
Displays an OK/Cancel question dialog.
quest_msgbox_yesno
Displays a Yes/No question dialog.
wait_notifications
Waits for all notification windows to close and cleans up their threads.
warn_msgbox
Displays a warning message box.

Type Aliases§

HWND
Window handle (HWND). A value of 0 represents no window (null).