Trait winsafe::prelude::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>

Object Safety§

This trait is not object safe.

Implementors§