IContextMenu::QueryContextMenuIContextMenu::QueryContextMenu*
*Contents  *Index  *Topic Contents
*Previous Topic: IContextMenu::InvokeCommand
*Next Topic: IContextMenu2

IContextMenu::QueryContextMenu


HRESULT QueryContextMenu(
    HMENU hmenu,
    UINT indexMenu,
    UINT idCmdFirst,
    UINT idCmdLast,
    UINT uFlags
   );

Adds menu items to the specified menu. The menu items should be inserted in the menu at the position specified by indexMenu, and their menu item identifiers must be between the idCmdFirst and idCmdLast parameter values.

hmenu
Handle to the menu. The handler should specify this handle when adding menu items.
indexMenu
Zero-based position at which to insert the first menu item.
idCmdFirst
Minimum value that the handler can specify for a menu item identifier.
idCmdLast
Maximum value that the handler can specify for a menu item identifier.
uFlags
Optional flags specifying how the context menu can be changed. Can be any combination of the following values:
CMF_CANRENAME This flag is set if the calling application supports renaming of items. A context menu extension or drag-and-drop handler should ignore this flag. A namespace extension should add a rename item to the menu if applicable.
CMF_DEFAULTONLY This flag is set when the user is activating the default action, typically by double-clicking. This flag provides a hint for the context menu extension to add nothing if it does not modify the default item in the menu. A context menu extension or drag-and-drop handler should not add any menu items if this value is specified. A namespace extension should add only the default item (if any).
CMF_EXPLORE This flag is set when Windows Explorer's tree window is present. Context menu handlers should ignore this value.
CMF_INCLUDESTATIC This flag is set when a static menu is being constructed. Only the browser should use this flag. All other context menu extensions should ignore this flag.
CMF_NODEFAULT This flag is set if no item in the menu should be the default item. A context menu extension or drag-and-drop handler should ignore this flag. A namespace extension should not set any of the menu items to the default.
CMF_NORMAL Indicates normal operation. A context menu extension, namespace extension, or drag-and-drop handler can add all menu items.
CMF_NOVERBS This flag is set for items displayed in the "Send To:" menu. Context menu handlers should ignore this value.
CMF_VERBSONLY This flag is set if the context menu is for a shortcut object. Context menu handlers should ignore this value.

The remaining bits of the low-order word are reserved by the system. The high-order word may be used for context-specific communications. The CMF_RESERVED value can be used to mask out the low-order word.

The actual identifier of each menu item should be idCmdFirst plus a menu identifier offset in the range zero through (idCmdLastidCmdFirst).

See also IContextMenu


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.