SHCreateDefaultContextMenu function (shlobj_core.h)

Creates an object that represents the Shell's default context menu implementation.

Syntax

SHSTDAPI SHCreateDefaultContextMenu(
  [in]  const DEFCONTEXTMENU *pdcm,
        REFIID               riid,
  [out] void                 **ppv
);

Parameters

[in] pdcm

Type: const DEFCONTEXTMENU*

A pointer to a constant DEFCONTEXTMENU structure.

riid

Type: REFIID

Reference to the interface ID of the interface on which to base the object. This is typically the IID of IContextMenu, IContextMenu2, or IContextMenu3.

[out] ppv

Type: void**

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

Return value

Type: HRESULT

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

Remarks

This function is typically used in the implementation of IShellFolder::GetUIObjectOf. GetUIObjectOf creates a context menu that merges IContextMenu handlers specified by the DEFCONTEXTMENU structure, and can optionally provide default context menu verb implementations such as open, explore, delete, and copy.

The operation of this function is controlled by the input specified in the DEFCONTEXTMENU structure.The APICDefFolderMenu_Create2 is another way to construct the default context menu implementation. It is less expressive than SHCreateDefaultContextMenu but it exists in platforms prior to Windows Vista.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shlobj_core.h (include Shlobj.h)
DLL Shell32.dll (version 6.0.6000 or later)
API set ext-ms-win-shell-shell32-l1-2-2 (introduced in Windows 10, version 10.0.14393)