Trait winsafe::prelude::shell_IShellItem

source ·
pub trait shell_IShellItem: ole_IUnknown {
    // Provided methods
    fn BindToHandler<T>(
        &self,
        bind_ctx: Option<&impl ole_IBindCtx>,
        bhid: &BHID
    ) -> HrResult<T>
       where T: ole_IUnknown { ... }
    fn Compare(
        &self,
        other: &impl shell_IShellItem,
        hint: SICHINTF
    ) -> HrResult<i32> { ... }
    fn GetAttributes(&self, sfgao_mask: SFGAO) -> HrResult<SFGAO> { ... }
    fn GetDisplayName(&self, sigdn_name: SIGDN) -> HrResult<String> { ... }
    fn GetParent(&self) -> HrResult<IShellItem> { ... }
}
Available on crate features kernel and shell only.
Expand description

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

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn BindToHandler<T>( &self, bind_ctx: Option<&impl ole_IBindCtx>, bhid: &BHID ) -> HrResult<T>
where T: ole_IUnknown,

IShellItem::BindToHandler method.

§Examples

Retrieving the items inside a directory:

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

let sh_folder: w::IShellItem; // initialized somewhere

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

fn Compare( &self, other: &impl shell_IShellItem, hint: SICHINTF ) -> HrResult<i32>

source

fn GetAttributes(&self, sfgao_mask: SFGAO) -> HrResult<SFGAO>

source

fn GetDisplayName(&self, sigdn_name: SIGDN) -> HrResult<String>

IShellItem::GetDisplayName method.

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

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

let full_path = shi.GetDisplayName(co::SIGDN::FILESYSPATH)?;

println!("{}", full_path);
source

fn GetParent(&self) -> HrResult<IShellItem>

IShellItem::GetParent method.

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

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

let parent_shi = shi.GetParent()?;
let full_path = parent_shi.GetDisplayName(co::SIGDN::FILESYSPATH)?;

println!("{}", full_path);

Object Safety§

This trait is not object safe.

Implementors§