Adds a sub-menu to the ToolbarMenu.
[Visual Basic .NET] Public Function AddSubMenu ( _ ByVal MenuOrPalette As Object, _ [ByVal index As Integer], _ [ByVal beginGroup As Boolean] _ ) As Integer
[C#] public int AddSubMenu ( object MenuOrPalette, int index, bool beginGroup );
Optional Values
[C++]
HRESULT AddSubMenu(
VARIANT MenuOrPalette,
long index,
VARIANT_BOOL beginGroup,
long* itemIndex
);
[C++]Parameters
MenuOrPalette [in] MenuOrPalette is a parameter of type VARIANT index [in, optional, defaultvalue(-1)] index is a parameter of type long beginGroup [in, optional, defaultvalue(VARIANT_FALSE)] beginGroup is a parameter of type VARIANT_BOOL itemIndex [out, retval] itemIndex is a parameter of type long
Product Availability
Description
Takes the specified menu and creates a new sub menu that is added to the ToolbarMenu, and returns the index of the menu. Specifiy the menu as either a IUid, ProgID, IMenuDef or IToolbarMenu.
Index determines the position on the ToolbarMenu that the Item will be added to. By default this is -1 and represents the end of the ToolbarMenu.
beginGroup determines whether a separator will appear before the Item. By default beginGroup is False.
Errors Returned
1023 800a03FF: The specified index is out of range
1047 800a0417: Errors occured adding the specified menu to the toolbar
1072 800a0430: The specified item cannot be added as a submenu
Remarks
AddSubMenu checks to see if the commands used by the menu already exists in the CommandPool used by the ToolbarMenu. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command . If the command already exists in the CommandPool its ICommandPool::UsageCount is incremented by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool.
Where possible always supply commands and menus as either Uid objects or ProgID's. Only supply commands as ICommand or IMenuDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl.