次の方法で共有


Enabling MMC 2.0 Standard Verbs

A primary snap-in has the opportunity to enable MMC standard verbs for scope or result items when its IComponent::Notify method is called with the MMCN_SELECT notification message. Be aware that MMC standard verbs are not to be confused with context menu items that snap-ins can add to the context menus of their scope and result items. For more information about context menus, see Working with Context Menus.

The MMC_CONSOLE_VERB enumeration defines the command identifiers available for standard verbs. The following verbs are allowed:

  • MMC_VERB_NONE
  • MMC_VERB_OPEN
  • MMC_VERB_COPY
  • MMC_VERB_PASTE
  • MMC_VERB_DELETE
  • MMC_VERB_PROPERTIES
  • MMC_VERB_RENAME
  • MMC_VERB_REFRESH
  • MMC_VERB_PRINT
  • MMC_VERB_CUT

When a standard verb is enabled for an item and the user selects it, MMC calls the snap-in's IComponent::Notify method with the appropriate notification message. See the MMC_CONSOLE_VERB documentation in the MMC SDK for details.

Be aware that MMC does not send a notification message in the case of the MMC_VERB_PROPERTIES, MMC_VERB_COPY and MMC_VERB_CUT verbs. When the MMC_VERB_PROPERTIES verb is enabled and the user selects it, MMC calls the IExtendPropertySheet2::CreatePropertyPages method of all snap-ins (primary and extension) that add property pages for the selected item. Be aware that primary snap-ins are responsible for enabling the MMC_VERB_PROPERTIES verb. Extension snap-ins cannot do this, because they do not own the item for which the verb is enabled.

If the snap-in does not explicitly enable or hide MMC_VERB_CUT but does enable MMC_VERB_COPY and MMC_VERB_DELETE, then MMC_VERB_CUT will be automatically enabled. Once the snap-in explicitly enables and does not hide MMC_VERB_CUT, then the states of MMC_VERB_COPY and MMC_VERB_DELETE do not automatically determine the MMC_VERB_CUT state. If MMC_VERB_COPY and MMC_VERB_DELETE are enabled and MMC_VERB_CUT is hidden, then MMC_VERB_CUT will not appear as an item in a context menu or toolbar, but the Cut verb could be invoked by means of the keyboard accelerator (Ctrl+X).

When the MMC_VERB_COPY or MMC_VERB_CUT verb is enabled and the user selects it, MMC calls the snap-in's IComponentData::QueryDataObject or IComponent::QueryDataObject implementation to request a data object for the selected item.

The MMC_VERB_DELETE, MMC_VERB_COPY, and MMC_VERB_PASTE verbs must all be enabled in snap-ins that support cut/copy/paste operations. Be aware that snap-ins that support cut/copy/paste operations also automatically support drag-and-drop operations as well — no extra coding is required. For more information, see Drag and Drop.

As mentioned above, snap-ins enable standard verbs in their MMCN_SELECT notification handler. In the notification handler, snap-ins should call IConsole2::QueryConsoleVerb to request a pointer to MMC's IConsoleVerb interface implementation. Using the returned interface pointer, snap-ins can then call the IConsoleVerb::SetVerbState method to enable (or disable) the standard verbs, one call per standard verb. Snap-ins can also call the SetDefaultVerb method to set the default verb for an item. The default verb is indicated in bold type in the item's context menu.

Some of the standard verbs have associated toolbar buttons. For example, when the MMC_VERB_DELETE verb is enabled for an item, MMC displays a toolbar button when the item is selected. The user can then either click the toolbar button or click the Delete context menu item to delete the item.

Note

MMC will not send Cut, Copy, Paste, or Rename notifications to OCX controls.

Enabling MMC Standard Verbs: Implementation Details

Enabling Drag and Drop in the MMC

Enabling Multiselection in the MMC