win-task-dialog 0.1.0

Simply call the Win32 API TaskDialogIndirect in Rust.
docs.rs failed to build win-task-dialog-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: win-task-dialog-0.1.7

Windows Task Dialog For Rust

Simply call the Win32 API TaskDialogIndirect in Rust.

Dependencies

[dependencies]
win-task-dialog-for-rust = "0.1.0"

[build-dependencies]
embed-resource = "1.6"

NOTE: You must be Enabling Visual Styles and using embed-resource to change manifest.

Example

extern crate win_task_dialog;

use win_task_dialog::*;

fn main() {
    let conf = TaskDialogConfig {
        parent: std::ptr::null_mut(),
        instance: std::ptr::null_mut(),
        flags: TDF_USE_COMMAND_LINKS,
        common_buttons: TDCBF_OK_BUTTON | TDCBF_CANCEL_BUTTON,
        window_title: "Title 标题".to_string(),
        main_instruction: "Привет".to_string(),
        content: "こんにちは".to_string(),
        verification_text: "VerificationText".to_string(),
        expanded_information: "".to_string(),
        expanded_control_text: "".to_string(),
        collapsed_control_text: "".to_string(),
        footer: "footer".to_string(),
        buttons: vec![
            TaskDialogButton {
                id: 10,
                text: "One".to_string(),
            },
            TaskDialogButton {
                id: 11,
                text: "".to_string(),
            },
        ],
        default_button: 11,
        radio_buttons: vec![
            TaskDialogButton {
                id: 10,
                text: "Option 1".to_string(),
            },
            TaskDialogButton {
                id: 11,
                text: "Option 2".to_string(),
            },
        ],
        default_radio_buttons: 0,
        main_icon: TD_SHIELD_ICON,
        footer_icon: TD_INFORMATION_ICON,
    };
    let result = show_task_dialog(&conf).unwrap();
    println!(
        "{} {} {}",
        result.button_id, result.radio_button_id, result.checked,
    )
}

Example Screenshot

Screenshot