IVsObjectList2.CountSourceItems Method (UInt32, IVsHierarchy, UInt32, UInt32)


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.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

int CountSourceItems(
	uint index,
	out IVsHierarchy ppHier,
	out uint pItemid,
	out uint pcItems


Type: System.UInt32

[in] Specifies the index of the list item of interest.

Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy

[out] Pointer to an IVsHierarchy interface.

Type: System.UInt32

[out] Specifies the itemid of an item within the hierarchy. Values are described in VSITEMID.

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.

From vsshell80.idl:


HRESULT IVsObjectList2::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 is 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.

Return to top