Trait winsafe::prelude::shell_IEnumShellItems

source ·
pub trait shell_IEnumShellItems: ole_IUnknown {
    // Provided methods
    fn iter(&self) -> impl Iterator<Item = HrResult<IShellItem>> + '_ { ... }
    fn Next(&self) -> HrResult<Option<IShellItem>> { ... }
    fn Reset(&self) -> HrResult<()> { ... }
    fn Skip(&self, count: u32) -> HrResult<bool> { ... }
}
Available on crate features kernel and shell only.
Expand description

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

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn iter(&self) -> impl Iterator<Item = HrResult<IShellItem>> + '_

Returns an iterator over the IShellItem elements which calls IEnumShellItems::Next internally.

§Examples

Enumerating the items in a folder by iterating over the IShellItem objects:

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

let folder = w::SHCreateItemFromParsingName::<w::IShellItem>(
    "C:\\Temp",
    None::<&w::IBindCtx>,
)?;

let items = folder.BindToHandler::<w::IEnumShellItems>(
    None::<&w::IBindCtx>,
    &co::BHID::EnumItems,
)?;

for item in items.iter() {
    let item = item?;
    println!("{}", item.GetDisplayName(co::SIGDN::FILESYSPATH)?);
}
source

fn Next(&self) -> HrResult<Option<IShellItem>>

IEnumShellItems::Next method.

Prefer using IEnumShellItems::iter, which is simpler.

source

fn Reset(&self) -> HrResult<()>

source

fn Skip(&self, count: u32) -> HrResult<bool>

Object Safety§

This trait is not object safe.

Implementors§