Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The QueryContextMenumethod adds the new menu items to a context menu.
Syntax
HRESULT QueryContextMenu ( HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags ); |
Parameters
- hmenu
-
[in] The menu to which additional items are added.
- indexMenu
-
[in] Specifies the location on the menu (must never be –1).
- idCmdFirst
-
[in] The beginning of the specified range.
- idCmdLast
-
[in] The end of the specified range.
- uFlags
-
[in] Specifies the context. See the Remarkssection for the list of supported flags.
Return Value
QueryContextMenureturns the number of items that were added to the context menu. The number of items added is also the maximum menu item ID offset ( USHORT) in the code field ( LOWORD) of the scode.
Note: |
---|
If there are gaps between menu items, the number is provided as if there were no gaps. |
Remarks
The QueryContextMenumethod can insert one or more new menu items into the specified menu hmenu, at the specified location indexMenu, with the IDs of those menu items. IDs must be in the range specified from idCmdFirstto idCmdLast. The QueryContextMenumethod returns the maximum menu item ID offset ( USHORT) in the code field ( LOWORD) of the scode. The HIWORDis reserved for context specific communications, and the LOWORDis reserved for system use. The uFlagsparameter specifies the context of the invocation.
The following table lists the possible values for the uFlagsparameter.
Flag | Value | Description |
---|---|---|
CMF_NORMAL |
0x00000000 |
Passed when the user right-clicks or taps and holds an object in the content pane. This is referred to as the normal action. Note that a shortcut menu extension, namespace extension, or drag-and-drop handler can add all menu items. |
CMF_DEFAULTONLY |
0x00000001 |
Passed when the user double-clicks or taps an object in the content pane. This is referred to as the default action. QueryContextMenureturns NOERROR, and no menu items are added to the context menu. |
CMF_VERBSONLY |
0x00000002 |
Passed when constructing a context menu for a short-cut object. QueryContextMenunever adds unsuitable menu items to context menus. An example of an unsuitable menu item is Delete, because it is not clear whether Deleteshould remove the link source item or just the link. |
CMF_EXPLORE |
0x00000004 |
Passed when the user right-clicks or taps and holds an object in the navigation pane. This flag is ignored. |
Requirements
Header | shlobj.h |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Pocket PC 2000 and later |