IShellFolder::GetUIObjectOf method (shobjidl_core.h)

Gets an object that can be used to carry out actions on the specified file objects or folders.

Syntax

HRESULT GetUIObjectOf(
  [in]      HWND                  hwndOwner,
  [in]      UINT                  cidl,
  [in]      PCUITEMID_CHILD_ARRAY apidl,
  [in]      REFIID                riid,
  [in, out] UINT                  *rgfReserved,
  [out]     void                  **ppv
);

Parameters

[in] hwndOwner

Type: HWND

A handle to the owner window that the client should specify if it displays a dialog box or message box.

[in] cidl

Type: UINT

The number of file objects or subfolders specified in the apidl parameter.

[in] apidl

Type: PCUITEMID_CHILD_ARRAY

The address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object or subfolder relative to the parent folder. Each item identifier list must contain exactly one SHITEMID structure followed by a terminating zero.

[in] riid

Type: REFIID

A reference to the IID of the interface to retrieve through ppv. This can be any valid interface identifier that can be created for an item. The most common identifiers used by the Shell are listed in the comments at the end of this reference.

[in, out] rgfReserved

Type: UINT*

Reserved.

[out] ppv

Type: void**

When this method returns successfully, contains the interface pointer requested in riid.

Return value

Type: HRESULT

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

Remarks

If cidl is greater than one, the IShellFolder::GetUIObjectOf implementation should only succeed if it can create one object for all items specified in apidl. If the implementation cannot create one object for all items, this method will fail.

The following are the most common interface identifiers the Shell uses when requesting an interface from this method. The list also indicates if cidl can be greater than one for the requested interface.

Interface Identifier Allowed cidl Value
IContextMenu The cidl parameter can be greater than or equal to one.
IContextMenu2 The cidl parameter can be greater than or equal to one.
IDataObject The cidl parameter can be greater than or equal to one.
IDropTarget The cidl parameter can only be one.
IExtractIcon The cidl parameter can only be one.
IQueryInfo The cidl parameter can only be one.
 

We recommend that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riid and ppv parameters. This macro provides the correct IID based on the interface pointed to by the value in ppv, which eliminates the possibility of a coding error in riid that could lead to unexpected results.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll (version 4.0 or later)

See also

IShellFolder

IShellFolder2