IContextMenuProvider

[This is preliminary documentation and subject to change.]

The IContextMenuProvider interface implements methods that create new context menus, to add items to those menus, to enable extensions to extend those menus, and to display the resultant context menus.

When to Implement

You do not implement this interface. It is implemented by the Microsoft Management Console's node manager.

When to Use

Use this interface only when you are implementing an OCX that displays context menus independently of those in the scope pane and list view result pane. Although it is possible to use the Win32 API to create context menus, it is generally advisable for snap-in components to use IContextMenuProvider because it provides third-party extensions the opportunity to extend the context menus.

If you are using a general purpose OCX that must be able to display context menus outside of the Microsoft Management Console, you may use the Win32 API. However, those context menus will not be extensible through the MMC context menu extension mechanism.

Methods in Vtable Order

Note that IContextMenuProvider is derived from IContextMenuCallback so you can call the methods of IContextMenuCallback on an instance of IContextMenuProvider.

IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IContextMenuCallback Methods Description
AddItem Adds one item to the context menu.

IContextMenuProvider Methods Description
EmptyMenuList Clears the context menu.
AddPrimaryExtensionItems Enables one specific snap-in to extend the context menu.
AddThirdPartyExtensionItems Enables all snap-ins that have registered as third-party context menu extensions for this node type to extend the context menu.
ShowContextMenu Displays the context menu.