Contents Index Topic Contents | ||
Previous Topic: ICommDlgBrowser::OnStateChange Next Topic: IContextMenu::GetCommandString |
IContextMenu
The IContextMenu interface is used to either create or merge a context menu associated with a certain object.
Default context menus are available for most objects that are visible within Windows Explorer's namespace, such as files, folders, and printer objects. System-provided context menus are adaptable to file objects of any type, provided you have made the appropriate registry entries.
When to Implement
Implement IContextMenu in the following situations:
- To add dynamic menu items to a context menu associated with an object in the shell's namespace. Implementation is accomplished by means of a handler located within a COM in-process server DLL.
- To allow menu items to be dynamically added to nondefault drag-and-drop menus. Implementation is accomplished by means of a handler.
- Applications may either create or merge items' context menus in the shell's namespace (or extended namespace). This is accomplished by an application calling IContextMenu using the IShellFolder::GetUIObjectOf method.
- A namespace extension should implement IContextMenu so that either the shell or another application can access context menus belonging to items in the namespace. This is accomplished by using IShellFolder::GetUIObjectOf.
Shell extensions based on this interface must be initialized by using the IShellExtInit interface.
Also note that shell extensions do not work unless all appropriate registry entries are made.
When to Use
You do not call this interface directly. It is called by the shell when a user chooses a context menu item that has been added by a handler registered under the appropriate registry keys or when an application includes it as the riid parameter in a call to IShellFolder::GetUIObjectOf.
IContextMenu Methods Description GetCommandString Retrieves the language-independent name of a menu command or the Help text for a menu command. InvokeCommand Carries out a menu command. For an example, see the IExtractIcon interface. QueryContextMenu Adds commands to a context menu.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.