pub trait ShellFolder {
Show 13 methods
// Required methods
fn parse_display_name(
&self,
hwnd: HWND,
display_name: PCWSTR,
) -> Result<(usize, RelativeIDList)>;
fn compare_ids(
&self,
param: CompareIDs,
pidl1: &RelativeIDList,
pidl2: &RelativeIDList,
) -> Result<Ordering>;
fn get_attributes_of(
&self,
children: &[ChildIDRef<'_>],
mask: ItemAttributes,
) -> Result<ItemAttributes>;
fn get_display_name_of(
&self,
pidl: ChildIDRef<'_>,
uflags: SHGDNF,
) -> Result<BSTR>;
// Provided methods
fn from_desktop() -> Result<IShellFolder> { ... }
fn from_id_list(pidl: &RelativeIDList) -> Result<IShellFolder> { ... }
fn from_path_w(hwnd: HWND, path: PCWSTR) -> Result<IShellFolder> { ... }
fn from_fs_any(hwnd: HWND) -> Result<IShellFolder> { ... }
fn parse_display_name_to_id_list(
&self,
hwnd: HWND,
display_name: PCWSTR,
) -> Result<RelativeIDList> { ... }
fn is_child_folder(&self, child: ChildIDRef<'_>) -> bool { ... }
fn is_child_fs_folder(&self, child: ChildIDRef<'_>) -> bool { ... }
fn are_children_folders(&self, children: &[ChildIDRef<'_>]) -> bool { ... }
fn get_path_of(&self, pidl: ChildIDRef<'_>) -> Result<BSTR> { ... }
}Expand description
Required Methods§
Sourcefn parse_display_name(
&self,
hwnd: HWND,
display_name: PCWSTR,
) -> Result<(usize, RelativeIDList)>
fn parse_display_name( &self, hwnd: HWND, display_name: PCWSTR, ) -> Result<(usize, RelativeIDList)>
Translates the display name of a file object or a folder into an item identifier list.
- Doesn’t handle relative path or parent folder indicators (“.” or “..”).
- Case-insensitive.
IShellFolder::ParseDisplayName (shobjidl_core.h)
§Returns
When it is no longer needed, it is the responsibility of the caller to free this resource by calling [CoTaskMemFree].
Sourcefn compare_ids(
&self,
param: CompareIDs,
pidl1: &RelativeIDList,
pidl2: &RelativeIDList,
) -> Result<Ordering>
fn compare_ids( &self, param: CompareIDs, pidl1: &RelativeIDList, pidl2: &RelativeIDList, ) -> Result<Ordering>
IShellFolder::CompareIDs (shobjidl_core.h)
See CompareIDs() for details.
Sourcefn get_attributes_of(
&self,
children: &[ChildIDRef<'_>],
mask: ItemAttributes,
) -> Result<ItemAttributes>
fn get_attributes_of( &self, children: &[ChildIDRef<'_>], mask: ItemAttributes, ) -> Result<ItemAttributes>
IShellFolder::GetAttributesOf (shobjidl_core.h)
§Returns
Requested attributes in mask that are common to all of the specified items.
Sourcefn get_display_name_of(
&self,
pidl: ChildIDRef<'_>,
uflags: SHGDNF,
) -> Result<BSTR>
fn get_display_name_of( &self, pidl: ChildIDRef<'_>, uflags: SHGDNF, ) -> Result<BSTR>
Retrieves the display name for a specified item in the namespace.
IShellFolder::GetDisplayNameOf (shobjidl_core.h)
§Parameters
-
pidl: Pointer to an item identifier list that identifies the child item. -
uflags: Flags that specify the type of display name to return.
§Returns
The display name of the item specified by pidl, in the format specified by uflags.
Because [STRRET] is hard to work with, this method converts it to BSTR
before returning. However, this introduces a mem alloc. If you want to avoid it
you can directly call [IShellFolder::GetDisplayNameOf()].
Provided Methods§
Sourcefn from_desktop() -> Result<IShellFolder>
fn from_desktop() -> Result<IShellFolder>
Retrieves the [IShellFolder] interface for the desktop folder, which is the root of the Shell’s namespace.
Sourcefn from_id_list(pidl: &RelativeIDList) -> Result<IShellFolder>
fn from_id_list(pidl: &RelativeIDList) -> Result<IShellFolder>
Creates a child folder that represents the folder containing the given item.
Sourcefn from_path_w(hwnd: HWND, path: PCWSTR) -> Result<IShellFolder>
fn from_path_w(hwnd: HWND, path: PCWSTR) -> Result<IShellFolder>
Creates a shell folder from a display name path.
This combines ShellFolder::parse_display_name() and ShellFolder::from_id_list to parse a path and return its folder.
Ref:
Sourcefn from_fs_any(hwnd: HWND) -> Result<IShellFolder>
fn from_fs_any(hwnd: HWND) -> Result<IShellFolder>
Returns an arbitrary object of CFSFolder.
fn parse_display_name_to_id_list( &self, hwnd: HWND, display_name: PCWSTR, ) -> Result<RelativeIDList>
Sourcefn is_child_folder(&self, child: ChildIDRef<'_>) -> bool
fn is_child_folder(&self, child: ChildIDRef<'_>) -> bool
Tests if the child is a Shell folder (not necessarily a file system directory).
This can also be implemented via ShellFolder::get_display_name_of().
But it’s probably slower as attributes are already stored in the ID.
Sourcefn is_child_fs_folder(&self, child: ChildIDRef<'_>) -> bool
fn is_child_fs_folder(&self, child: ChildIDRef<'_>) -> bool
Tests if the child is a file system directory.
This can also be implemented via ShellFolder::get_path_of().
But it’s probably slower as attributes are already stored in the ID.
Sourcefn are_children_folders(&self, children: &[ChildIDRef<'_>]) -> bool
👎Deprecated: This is usually not supported, including CFSFolder from Windows XP to 11
fn are_children_folders(&self, children: &[ChildIDRef<'_>]) -> bool
This is usually not supported, including CFSFolder from Windows XP to 11
Tests if the children are Shell folders (not necessarily file system directories).
This can also be implemented via ShellFolder::get_display_name_of().
But it’s probably slower as attributes are already stored in the ID.
Sourcefn get_path_of(&self, pidl: ChildIDRef<'_>) -> Result<BSTR>
fn get_path_of(&self, pidl: ChildIDRef<'_>) -> Result<BSTR>
Get the display name for parsing relative to the desktop.
i.e. get_display_name_of(SHGDN_FORPARSING)
§Returns
e.g. C:\Windows
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".