SHCreateItemInKnownFolder function

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

Syntax

SHSTDAPI SHCreateItemInKnownFolder(
  REFKNOWNFOLDERID kfid,
  DWORD            dwKFFlags,
  PCWSTR           pszItem,
  REFIID           riid,
  void             **ppv
);

Parameters

kfid

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

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

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

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

   
Windows version Windows Vista [desktop apps only] Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll

See Also

Known Folders Sample