IContextMenuCallback::AddItem
[This is preliminary documentation and subject to change.]
Adds a single item to a context menu.
HRESULT AddItem(
CONTEXTMENUITEM * pItem // Pointer to the identifying structure
);
Parameters
-
pItem
-
[in] Pointer to a CONTEXTMENUITEM structure with the item to be added. This parameter may not be NULL.
Return Values
-
S_OK
-
The menu item was successfully added.
-
E_UNEXPECTED
-
An unexpected error occurred.
-
E_POINTER
-
The pItem parameter is NULL.
-
E_INVALIDARG
-
One or more of the following conditions occurred:
-
An item already exists with this lCommandID. See CONTEXTMENUITEM.
-
The insertion point identified by the iInsertionPointID member of CONTEXTMENUITEM could not be found.
-
The command ID (if you are adding a menu item) or insertion point ID (if you are adding a submenu or insertion point) identified by the lCommandID member of CONTEXTMENUITEM is invalid or cannot be used at this time. For example, snap-ins acting as context menu extensions cannot insert or reference a primary insertion point. See CONTEXTMENUITEM.
-
fFlags contains MF_OWNERDRAW or MF_BITMAP. See CONTEXTMENUITEM.
-
An extension tried to add an item where either fFlags contains MF_SEPARATOR or fSpecialFlags contains CCM_SPECIAL_SEPARATOR. See CONTEXTMENUITEM.
-
strName is NULL and this is not a separator or insertion point. See CONTEXTMENUITEM.
-
fSpecialFlags contains CCM_SPECIAL_SUBMENU, but fFlags does not contain MF_POPUP.
See Also
CONTEXTMENUITEM, IContextMenuCallback