SHGetItemFromObject function (shobjidl_core.h)

Retrieves an IShellItem for an object.

Syntax

SHSTDAPI SHGetItemFromObject(
  [in]  IUnknown *punk,
  [in]  REFIID   riid,
  [out] void     **ppv
);

Parameters

[in] punk

Type: IUnknown*

A pointer to the IUnknown of the object.

[in] riid

Type: REFIID

Reference to the desired IID.

[out] ppv

Type: void**

When this method returns, contains the interface pointer requested in riid. This is typically IShellItem or a related interface.

Return value

Type: HRESULT

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

Remarks

From the standpoint of performance, this method is preferred to SHGetIDListFromObject in those cases where the IDList is already bound to a folder.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll

See also

SHCreateItemFromIDList

SHGetIDListFromObject