Trait shell_IFileOpenDialog

Source
pub trait shell_IFileOpenDialog: shell_IFileDialog {
    // Provided methods
    fn GetResults(&self) -> HrResult<IShellItemArray> { ... }
    fn GetSelectedItems(&self) -> HrResult<IShellItemArray> { ... }
}
Available on crate features kernel and shell only.
Expand description

This trait is enabled with the shell feature, and provides methods for IFileOpenDialog.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

Source

fn GetResults(&self) -> HrResult<IShellItemArray>

IFileOpenDialog::GetResults method.

If you chose multiple files, this is the method to retrieve the paths.

§Examples

Collecting the file paths into a Vec:

use winsafe::{self as w, prelude::*, co};

let fo: w::IFileOpenDialog; // initialized somewhere

let paths = fo.GetResults()?
    .iter()?
    .map(|shi| shi?.GetDisplayName(co::SIGDN::FILESYSPATH))
    .collect::<w::HrResult<Vec<_>>>()?;
Source

fn GetSelectedItems(&self) -> HrResult<IShellItemArray>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§