IContextMenu::QueryContextMenu

[Now Supported on Windows NT]

Adds menu items to the specified menu. The menu items should be inserted at a specified position in the menu, and their menu item identifiers must be in a given range.

HRESULT QueryContextMenu(

HMENU hmenu, //Handle of the menu
UINT indexMenu, //Location to insert first menu item
UINT idCmdFirst, //Minimum value for a menu item identifier
UINT idCmdLast, //Maximum value for a menu item identifier
UINT uFlags //Specifies zero or more status values
);  

Parameters

hmenu

Handle of the menu. The handler should specify this handle when calling the InsertMenu or InsertMenuItem function.

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 menu item identifiers.

uFlags

Flag specifying zero or more of the following values:

CMF_DEFAULTONLY The user is activating the default action, typically by double-clicking. This value provides a hint for the context menu 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 name space extension should add only the default item (if any).
CMF_EXPLORE Context menu handlers should ignore this value. It is specified when the context menu is for an object in the Explorer.
CMF_NORMAL Indicates normal operation. A context menu extension, name-space extension, or drag and drop handler can add any menu items.
CMF_VERBSONLY Context menu handlers should ignore this value. This value is specified if the context menu is for a shortcut object. This value is specified if the context menu is for a shortcut object.

The remaining bits of the low-order word are reserved by the system. The high-order word may be used for context-specific communications.

Return Values

Returns an HRESULT structure in which, if the method is successful, the code member contains the menu identifier offset of the last menu item added plus one.

Comments

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

See Also

IContextMenu, InsertMenu, InsertMenuItem