Shell Functions


SHOpenFolderAndSelectItems Function

Opens a Windows Explorer window with specified items in a particular folder selected.

Syntax

HRESULT SHOpenFolderAndSelectItems(      
    PCIDLIST_ABSOLUTE pidlFolder,     UINT cidl,     PCUITEMID_CHILD_ARRAY *apidl,     DWORD dwFlags );

Parameters

pidlFolder
[in] A pointer to a fully qualified pointer to an item identifier list (PIDL) that specifies the folder.
cidl
[in] A count of items in the selection array, apidl. If cidl is zero, then pidlFolder must point to a fully specified ITEMIDLIST describing a single item to select. This function opens the parent folder and selects that item.
apidl
[in] A pointer to an array of PIDL structures, each of which is an item to select in the target folder referenced by pidlFolder.
dwFlags
[in] The optional flags. Under Windows XP this parameter is ignored. In Windows Vista, the following flags are defined.
OFASI_EDIT
Select an item and put its name in edit mode. This flag can only be used when a single item is being selected. For multiple item selections, it is ignored.
OFASI_OPENDESKTOP
Select the item or items on the desktop rather than in a Windows Explorer window. Note that if the desktop is obscured behind open windows, it will not be made visible.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

CoInitialize or CoInitializeEx must be called before using SHOpenFolderAndSelectItems. Not doing so causes SHOpenFolderAndSelectItems to fail.

Function Information

Minimum DLL Versionshell32.dll version 6.0 or later
Custom ImplementationNo
Headershlobj.h
Import libraryshell32.lib
Minimum operating systems Windows XP
Tags :


Page view tracker