Compartir a través de


IVsProfferCommands3.FindCommandBar Method

Find a specific toolbar.

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

Syntax

'Declaration
Function FindCommandBar ( _
    pToolbarSet As Object, _
    ByRef pguidCmdGroup As Guid, _
    dwMenuId As UInteger, _
    <OutAttribute> ByRef ppdispCmdBar As Object _
) As Integer
int FindCommandBar(
    Object pToolbarSet,
    ref Guid pguidCmdGroup,
    uint dwMenuId,
    out Object ppdispCmdBar
)
int FindCommandBar(
    [InAttribute] Object^ pToolbarSet, 
    [InAttribute] Guid% pguidCmdGroup, 
    [InAttribute] unsigned int dwMenuId, 
    [OutAttribute] Object^% ppdispCmdBar
)
abstract FindCommandBar : 
        pToolbarSet:Object * 
        pguidCmdGroup:Guid byref * 
        dwMenuId:uint32 * 
        ppdispCmdBar:Object byref -> int
function FindCommandBar(
    pToolbarSet : Object, 
    pguidCmdGroup : Guid, 
    dwMenuId : uint, 
    ppdispCmdBar : Object
) : int

Parameters

  • pToolbarSet
    Type: Object

    [in] Use nulla null reference (Nothing in Visual Basic).

  • pguidCmdGroup
    Type: 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: UInt32

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

  • ppdispCmdBar
    Type: Object%

    [out] The toolbar.

Return Value

Type: Int32
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.

.NET Framework Security

See Also

Reference

IVsProfferCommands3 Interface

Microsoft.VisualStudio.Shell.Interop Namespace