CDefFolderMenu_Create2 function (shlobj_core.h)

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

Syntax

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

Parameters

[in, optional] pidlFolder

Type: PCIDLIST_ABSOLUTE

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

[in, optional] 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.

[in, optional] apidl

Type: PCUITEMID_CHILD_ARRAY*

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

[in, optional] 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.

[in, optional] 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.
 

[in, optional] 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.

[out] 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

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server 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