共用方式為


IVsObjectList.CountSourceItems Method

Returns the hierarchy and the number of ItemIDs corresponding to source files for the given list item.

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

Syntax

'宣告
Function CountSourceItems ( _
    index As UInteger, _
    <OutAttribute> ByRef ppHier As IVsHierarchy, _
    <OutAttribute> ByRef pitemid As UInteger, _
    <OutAttribute> ByRef pcItems As UInteger _
) As Integer
'用途
Dim instance As IVsObjectList
Dim index As UInteger
Dim ppHier As IVsHierarchy
Dim pitemid As UInteger
Dim pcItems As UInteger
Dim returnValue As Integer

returnValue = instance.CountSourceItems(index, _
    ppHier, pitemid, pcItems)
int CountSourceItems(
    uint index,
    out IVsHierarchy ppHier,
    out uint pitemid,
    out uint pcItems
)
int CountSourceItems(
    [InAttribute] unsigned int index, 
    [OutAttribute] IVsHierarchy^% ppHier, 
    [OutAttribute] unsigned int% pitemid, 
    [OutAttribute] unsigned int% pcItems
)
abstract CountSourceItems : 
        index:uint32 * 
        ppHier:IVsHierarchy byref * 
        pitemid:uint32 byref * 
        pcItems:uint32 byref -> int 
function CountSourceItems(
    index : uint, 
    ppHier : IVsHierarchy, 
    pitemid : uint, 
    pcItems : uint
) : int

Parameters

  • index
    Type: System.UInt32
    [in] Specifies the index of the list item of interest.
  • pitemid
    Type: System.UInt32%
    [out] Specifies the itemid of an item within the hierarchy. Values are described in VSITEMID.
  • pcItems
    Type: System.UInt32%
    [out] Pointer to the count of items.

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 IVsObjectList::CountSourceItems(
   [in] ULONG Index,
   [out] IVsHierarchy **ppHier,
   [out] VSITEMID *pitemid,
   [out, retval] ULONG *pcItems
);

Return the count of items (these must be from a single hierarchy) that make up the source files for the list element at index. Also return a pointer to the hierarchy in ppHier and pitemid if requested. If there is more than 1 item, return VSITEMID_SELECTION and a subsequent call will be made on GetMultipleSourceItems to get them. If there are no available source items, return VSITEMID_ROOT to indicate the root of the hierarchy as a whole.

This method applies to class view only, and must be implemented. This enables class view to act as an alternate hierarchy so that all your project level commands continue to work.

.NET Framework Security

See Also

Reference

IVsObjectList Interface

IVsObjectList Members

Microsoft.VisualStudio.Shell.Interop Namespace