Share via


IVsProfferCommands3.FindCommandBar(Object, Guid, UInt32, Object) Method

Definition

Find a specific toolbar.

public:
 int FindCommandBar(System::Object ^ pToolbarSet, Guid % pguidCmdGroup, System::UInt32 dwMenuId, [Runtime::InteropServices::Out] System::Object ^ % ppdispCmdBar);
public int FindCommandBar (object pToolbarSet, ref Guid pguidCmdGroup, uint dwMenuId, out object ppdispCmdBar);
abstract member FindCommandBar : obj * Guid * uint32 * obj -> int
Public Function FindCommandBar (pToolbarSet As Object, ByRef pguidCmdGroup As Guid, dwMenuId As UInteger, ByRef ppdispCmdBar As Object) As Integer

Parameters

pToolbarSet
Object

[in] Use null.

pguidCmdGroup
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
UInt32

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

ppdispCmdBar
Object

[out] The toolbar.

Returns

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

Remarks

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.

Applies to