Expand Minimize

SHCreateItemInKnownFolder function

Creates a Shell item object for a single file that exists inside a known folder.

Syntax


HRESULT SHCreateItemInKnownFolder(
  _In_      REFKNOWNFOLDERID kfid,
  DWORD dwKFFlags,
  _In_opt_  PCWSTR pszItem,
  _In_      REFIID riid,
  _Out_     void **ppv
);

Parameters

kfid [in]

Type: REFKNOWNFOLDERID

A reference to the KNOWNFOLDERID, a GUID that identifies the folder that contains the item.

dwKFFlags

Type: DWORD

Flags that specify special options in the object retrieval. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values.

pszItem [in, optional]

Type: PCWSTR

A pointer to a null-terminated buffer that contains the file name of the new item as a Unicode string. This parameter can also be NULL. In this case, an IShellItem that represents the known folder itself is created.

riid [in]

Type: REFIID

A reference to the IID of the interface that represents the item, retrieved through ppv. This value is typically IID_IShellItem or IID_IShellItem2.

ppv [out]

Type: void**

When this function returns successfully, contains the interface pointer requested in riid. This is typically IShellItem or IShellItem2.

Return value

Type: HRESULT

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

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Shobjidl.h

DLL

Shell32.dll

See also

Known Folders Sample

 

 

Community Additions

ADD
Show:
© 2015 Microsoft