SHCreateDefaultContextMenu function

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

Syntax

SHSTDAPI SHCreateDefaultContextMenu(
  const DEFCONTEXTMENU *pdcm,
  REFIID               riid,
  void                 **ppv
);

Parameters

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.

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

   
Windows version Windows Vista [desktop apps only] 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)