CDefFolderMenu_Create2 function

Creates a context menu for a selected group of file folder objects.

Syntax

SHSTDAPI CDefFolderMenu_Create2(
  PCIDLIST_ABSOLUTE     pidlFolder,
  HWND                  hwnd,
  UINT                  cidl,
  PCUITEMID_CHILD_ARRAY apidl,
  IShellFolder          *psf,
  LPFNDFMCALLBACK       pfn,
  UINT                  nKeys,
  const HKEY            *ahkeys,
  IContextMenu          **ppcm
);

Parameters

pidlFolder

Type: PCIDLIST_ABSOLUTE

An ITEMIDLIST structure for the parent folder. This value can be NULL.

hwnd

Type: HWND

A handle to the parent window. This value can be NULL.

cidl

Type: UINT

The number of ITEMIDLIST structures in the array pointed to by apidl.

apidl

Type: PCUITEMID_CHILD_ARRAY*

A pointer to an array of ITEMIDLIST structures, one for each item that is selected.

psf

Type: IShellFolder*

A pointer to the parent folder's IShellFolder interface. This IShellFolder must support the IDataObject interface. If it does not, CDefFolderMenu_Create2 fails and returns E_NOINTERFACE. This value can be NULL.

pfn

Type: LPFNDFMCALLBACK

The LPFNDFMCALLBACK callback object. This value can be NULL if the callback object is not needed.

nKeys

Type: UINT

The number of registry keys in the array pointed to by ahkeys.

Note  The maximum number of registry keys is 16. Callers must enforce this limit as the API does not. Failing to do so can result in memory corruption.
 

ahkeys

Type: const HKEY*

A pointer to an array of registry keys that specify the context menu handlers used with the menu's entries. For more information on context menu handlers, see Creating Context Menu Handlers. This array can contain a maximum of 16 registry keys.

ppcm

Type: IContextMenu**

The address of an IContextMenu interface pointer that, when this function returns successfully, points to the IContextMenu object that represents the context menu.

Return Value

Type: HRESULT

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

Requirements

   
Windows version Windows 2000 Professional, Windows XP [desktop apps only] Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h)
Library Shell32.lib
DLL Shell32.dll (version 5.00 or later)

See Also

SHCreateDefaultContextMenu