IVsProfferCommands3::FindCommandBar Method (Object^, Guid, UInt32, Object^)

 

Find a specific toolbar.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

int FindCommandBar(
	Object^ pToolbarSet,
	[InAttribute] Guid% pguidCmdGroup,
	unsigned int dwMenuId,
	[OutAttribute] Object^% ppdispCmdBar
)

Parameters

pToolbarSet
Type: System::Object^

[in] Use null.

pguidCmdGroup
Type: System::Guid

[in] The GUID of the toolbar or menu to find. You can use GUID_Macro or GUID_AddIn (depending on the way the item was created), which are auto-generated GUIDs defined in vbapkg.idl.

dwMenuId
Type: System::UInt32

[in] The ID of the toolbar or menu..

ppdispCmdBar
Type: System::Object^

[out] The toolbar.

Return Value

Type: System::Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

This method always starts from the top level of menus and toolbars, and can be quite inefficient if you are trying to find a nested menu. This is because the Visual Studio shell has large numbers of top-level items, each of which has large collections of child items, which the shell must populate during the search. You should use this method mainly for top-level toolbars or menus.

The best way to find a nested menu or toolbar (for example, the New submenu on the File menu) is to first get a parent menu, and then use its Controls collection to find the node that you want.

Return to top
Show: