Platform SDK: Active Directory, ADSI, and Directory Services

Context Menus for Use with Display Specifiers

You can add context menus to the existing context menus for a particular object class within the Microsoft® Windows® shell or Active Directory™ administrative snap-ins. Context menu items may be either COM objects, which are activated using the standard COM instance creation methods, or an application that is invoked using the standard ShellExecute function.

For example, you can implement a context menu COM object that adds menu items to the context menu of the contact class. When a user views a contact object, your context menu items are displayed along with other context menu items in the contact context menu.

To extend context menus with context menu items from a COM object

  1. Write the context menu COM object. The context menu COM object must implement IShellExtInit and IContextMenu.
  2. Install the context menu COM object on the computers where you want the extension context menu items to be used. It is recommended that you create a Microsoft Installer package for your context menu COM object's DLL and deploy the package appropriately using the group policy. See Using MSI and Windows 2000 Application Deployment to Distribute UI Additions.
  3. Register the context menu extension for a particular object class so that the context menu is added to the context menus of objects of that class.

    For the Windows shell or Active Directory administrative snap-ins to recognize your context menu, you must add a value for your context menu COM object in the adminContextMenu and/or shellContextMenu property of the display specifier for the class whose context menu you want to extend. Note that you can register the same context menu COM object for more than one class.

    Note that registration is per locale. If the context menu COM object is specific to a certain locale, it should be registered in a displaySpecifier in the locale container that it applies to. If it applies to all locales, it should be added to the appropriate displaySpecifier (that is, the one that represents the class that should get the context menu extension) in all locale containers.

To extend context menus with context menu items that launch an application

  1. Install the application where you want the extension context menu items to be used.
  2. Register the context menu extension for a particular object class so that the context menu is added to the context menus of objects of that class. Note that value added for the extension takes a slightly different format.