Share via


IVsMultiItemSelect.GetSelectedItems Method

Returns an IVsHierarchy interface pointer and item identifier for selected items.

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

Syntax

'Declaration
Function GetSelectedItems ( _
    grfGSI As UInteger, _
    cItems As UInteger, _
    <OutAttribute> rgItemSel As VSITEMSELECTION() _
) As Integer
int GetSelectedItems(
    uint grfGSI,
    uint cItems,
    VSITEMSELECTION[] rgItemSel
)
int GetSelectedItems(
    [InAttribute] unsigned int grfGSI, 
    [InAttribute] unsigned int cItems, 
    [OutAttribute] array<VSITEMSELECTION>^ rgItemSel
)
abstract GetSelectedItems : 
        grfGSI:uint32 * 
        cItems:uint32 * 
        rgItemSel:VSITEMSELECTION[] byref -> int
function GetSelectedItems(
    grfGSI : uint, 
    cItems : uint, 
    rgItemSel : VSITEMSELECTION[]
) : int

Parameters

  • grfGSI
    Type: System.UInt32

    [in] Flag providing information about how the selected items should be returned. For valid grfGSI values, see __VSGSIFLAGS.

  • cItems
    Type: System.UInt32

    [in] Number of items that are selected.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsMultiItemSelect::GetSelectedItems(
   [in] VSGSIFLAGS grfGSI,
   [in] ULONG cItems,
   [out, size_is(cItems)] VSITEMSELECTION rgItemSel[]
);

If all selected items belong to a single hierarchy, set the pHier member of each VSITEMSELECTION structure to point to the IVsHierarchy interface for that hierarchy. Set the itemid member of each structure to VSITEMID_SELECTION.

If the selected items belong to multiple hierarchies, set the pHier member of each VSITEMSELECTION structure to point to the first common IVsHierarchy interface, typically the parent hierarchy. Set the itemid member of each structure to VSITEMID_SELECTION.

The information retrieved from GetSelectedItems can be used to update the Solution Explorer.

.NET Framework Security

See Also

Reference

IVsMultiItemSelect Interface

Microsoft.VisualStudio.Shell.Interop Namespace