[−][src]Function wfd::open_dialog
pub fn open_dialog(
params: DialogParams<'_>
) -> Result<OpenDialogResult, DialogError>
Displays an Open Dialog using the provided parameters.
Examples
// An entirely default Open File dialog box with no customization let result = wfd::open_dialog(Default::default());
// A folder-picker Open dialog box with a custom dialog title let params = wfd::DialogParams { options: wfd::FOS_PICKFOLDERS, title: "My custom open folder dialog", ..Default::default() }; let result = wfd::open_dialog(params)?; let path = result.selected_file_path;
// An Open dialog box with a custom dialog title and file types let params = wfd::DialogParams { title: "My custom open file dialog", file_types: vec![("JPG Files", "*.jpg;*.jpeg"), ("PDF Files", "*.pdf")], ..Default::default() }; let result = wfd::open_dialog(params)?; let path = result.selected_file_path;
Errors
If a user cancels the dialog, the UserCancelled
error is returned. The only other kinds of
errors that can be retured are COM HRESULT
failure codes - usually as the result of invalid
combinations of options. These are returned in a HResultFailed
error