Function winsafe::TaskDialogIndirect [−][src]
pub fn TaskDialogIndirect(
task_config: &TASKDIALOGCONFIG<'_, '_, '_, '_, '_, '_, '_, '_, '_, '_>,
verification_flag_checked: Option<&mut bool>
) -> WinResult<(DLGID, u16)>
Expand description
TaskDialogIndirect
function.
Returns:
- the selected
co::DLGID
button; - if
pRadioButtons
ofTASKDIALOGCONFIG
struct was set, theu16
control ID of one of the specified radio buttons; otherwise zero.
If you don’t need all customizations, consider the
TaskDialog
method.
Examples
ⓘ
use winsafe::{co, gui, IconIdTdicon,
TASKDIALOG_BUTTON TASKDIALOGCONFIG, TaskDialogIndirect,
WString};
let wnd: gui::WindowMain; // initialized somewhere
let mut tdc = TASKDIALOGCONFIG::default();
tdc.hwndParent = wnd.hwnd();
tdc.dwCommonButtons = co::TDCBF::YES | co::TDCBF::NO;
tdc.set_hMainIcon(IconIdTdicon::Tdicon(co::TD_ICON::INFORMATION));
let mut title = WString::from_str("Title");
tdc.set_pszWindowTitle(Some(&mut title));
let mut header = WString::from_str("Header");
tdc.set_pszMainInstruction(Some(&mut header));
let mut body = WString::from_str("Body");
tdc.set_pszContent(Some(&mut body));
// A custom button to appear before Yes and No.
let mut btn1 = TASKDIALOG_BUTTON::default();
let mut btn1_text = WString::from_str("Hello");
btn1.set_pszButtonText(Some(&mut btn1_text));
btn1.set_nButtonID(333); // this ID is returned if user clicks this button
let btns_slice = &mut [btn1];
tdc.set_pButtons(Some(btns_slice));
TaskDialogIndirect(&tdc, None)?;