Windows Dev Center

Expand Minimize

SHCreateShellItemArrayFromDataObject function

Creates a Shell item array object from a data object.

Syntax


HRESULT SHCreateShellItemArrayFromDataObject(
  _In_  IDataObject *pdo,
  _In_  REFIID      riid,
  _Out_ void        **ppv
);

Parameters

pdo [in]

Type: IDataObject*

A pointer to IDataObject interface.

riid [in]

Type: REFIID

A reference to the desired interface ID.

ppv [out]

Type: void**

When this method returns, contains the interface pointer requested in riid. This is typically IShellItemArray.

Return value

Type: HRESULT

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

Remarks

This function is usefull for Shell extensions that implement IShellExtInit and are passed a data object to the IShellExtInit::Initialize method; for example, context menu handlers.

This API lets you convert the data object into a Shell item that the handler can consume. It is recommend that handlers use a Shell item array rather than clipboard formats like CF_HDROP and CFSTR_SHELLIDLIST (also known as HIDA) as it leads to simpler code and allows some performance improvements.

The resulting shell item array holds a reference to the source data object. Therefore, that data object must remain valid for the lifetime of the shell item array. Notably, the data objects passed to IDropTarget methods are no longer valid after the drop operation completes.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Shobjidl.h

DLL

Shell32.dll

 

 

Community Additions

ADD
Show:
© 2015 Microsoft