Expand Minimize

SHCreateShellItem function

Creates an IShellItem object.

Note  It is recommended that you use SHCreateItemWithParent or SHCreateItemFromIDList instead of this function.

Syntax


HRESULT SHCreateShellItem(
  _In_opt_  PCIDLIST_ABSOLUTE pidlParent,
  _In_opt_  IShellFolder *psfParent,
  _In_      PCUITEMID_CHILD pidl,
  _Out_     IShellItem **ppsi
);

Parameters

pidlParent [in, optional]

Type: PCIDLIST_ABSOLUTE

A PIDL to the parent. This value can be NULL.

psfParent [in, optional]

Type: IShellFolder*

A pointer to the parent IShellFolder. This value can be NULL.

pidl [in]

Type: PCUITEMID_CHILD

A PIDL to the requested item. If parent information is not included in pidlParent or psfParent, this must be an absolute PIDL.

ppsi [out]

Type: IShellItem**

When this method returns, contains the interface pointer to the new IShellItem.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

SHCreateShellItem creates an object that represents a Shell namespace item. The caller must provide parent information in pidlParent or psfParent; alternatively, the caller can provide an absolute IDList in the pidl parameter.

There are three valid calling patterns for this function:

  1. The parent folder is identified by an absolute IDList pidlParent. The pidl parameter points to a child IDList that identifies the item within the folder identified by pidlParent.
    
    IShellItem *psi;
    SHCreateShellItem(pidlParent, NULL, pidlChild, &psi);
    
    
    
  2. The parent folder is identified by psfParent. The pidl parameter points to a child IDList that identifies the item within the folder identified by psfParent.
    
    IShellItem *psi;
    SHCreateShellItem(NULL, psfParent, pidlChild, &psi);
    
    
    
  3. The item is identified by an absolute IDList passed to the pidl parameter.
    
    IShellItem *psi;
    SHCreateShellItem(NULL, NULL, pidlFull, &psi);
    
    
    

Requirements

Minimum supported client

Windows XP with SP1 [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Shlobj.h

Library

Shell32.lib

DLL

Shell32.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft