IShellItem::BindToHandler method (shobjidl_core.h)

Binds to a handler for an item as specified by the handler ID value (BHID).

Syntax

HRESULT BindToHandler(
  IBindCtx *pbc,
  REFGUID  bhid,
  REFIID   riid,
  void     **ppv
);

Parameters

pbc

Type: IBindCtx*

A pointer to an IBindCtx interface on a bind context object. Used to pass optional parameters to the handler. The contents of the bind context are handler-specific. For example, when binding to BHID_Stream, the STGM flags in the bind context indicate the mode of access desired (read or read/write).

bhid

Type: REFGUID

Reference to a GUID that specifies which handler will be created. One of the following values defined in Shlguid.h:

BHID_SFObject

Restricts usage to BindToObject.

BHID_SFUIObject

Restricts usage to GetUIObjectOf.

BHID_SFViewObject

Restricts usage to CreateViewObject.

BHID_Storage

Attempts to retrieve the storage RIID, but defaults to Shell implementation on failure.

BHID_Stream

Restricts usage to IStream.

BHID_LinkTargetItem

CLSID_ShellItem is initialized with the target of this item (can only be SFGAO_LINK). See SFGAO for a description of SFGAO_LINK.

BHID_StorageEnum

If the item is a folder, gets an IEnumShellItems object with which to enumerate the storage contents.

BHID_Transfer

Introduced in Windows Vista: If the item is a folder, gets an ITransferSource or ITransferDestination object.

BHID_PropertyStore

Introduced in Windows Vista: Restricts usage to IPropertyStore or IPropertyStoreFactory.

BHID_ThumbnailHandler

Introduced in Windows Vista: Restricts usage to IExtractImage or IThumbnailProvider.

BHID_EnumItems

Introduced in Windows Vista: If the item is a folder, gets an IEnumShellItems object that enumerates all items in the folder. This includes folders, nonfolders, and hidden items.

BHID_DataObject

Introduced in Windows Vista: Gets an IDataObject object for use with an item or an array of items.

BHID_AssociationArray

Introduced in Windows Vista: Gets an IQueryAssociations object for use with an item or an array of items.

BHID_Filter

Introduced in Windows Vista: Restricts usage to IFilter.

BHID_EnumAssocHandlers

Introduced in Windows 7: Gets an IEnumAssocHandlers object used to enumerate the recommended association handlers for the given item.

BHID_RandomAccessStream

Introduced in Windows 8: Gets an IRandomAccessStream object for the item.

BHID_FilePlaceholder

Introduced in Windows 8.1: Gets an object used to provide placeholder file functionality.

riid

Type: REFIID

IID of the object type to retrieve.

ppv

Type: void**

When this method returns, contains a pointer of type riid that is returned by the handler specified by rbhid.

Return value

Type: HRESULT

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

Requirements

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

See also

IShellFolder

IShellItem