Platform SDK: Active Directory, ADSI, and Directory Services |
To extend context menus with custom menu items for directory objects, a context menu COM object must implement two shell interfaces: IShellExtInit and IContextMenu.
A context menu COM object is instantiated when the user opens the context menu for an object of a class for which the context menu extension has been registered. If the COM object was registered in the class's adminContextMenu property, the COM object's context menu items appear in the context menu for objects of that class in Active Directory administrative snap-ins. If it was registered in shellContextMenu, the context menu items appear in the Windows shell.
After the context menu COM object is instantiated, the IShellExtInit::Initialize method is called. The IShellExtInit interface has only one method and it must be implemented. This is the context menu COM object's only opportunity to get the IDataObject pointer that enables the object to get information about the selected directory objects. Follow the same rules and recommendations as the implementation for property page COM objects. See Implementing the Property Page COM Object.
After IShellExtInit::Initialize returns, the IContextMenu::QueryContextMenu method is called. The IContextMenu interface has three methods that must be implemented: