IVsHasRelatedSaveItems.GetRelatedSaveTreeItems Method

Gets the number of related items to save, or returns a list of related items to save.

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

Syntax

'宣言
Function GetRelatedSaveTreeItems ( _
    saveItem As VSSAVETREEITEM, _
    celt As UInteger, _
    <OutAttribute> rgSaveTreeItems As VSSAVETREEITEM(), _
    <OutAttribute> ByRef pcActual As UInteger _
) As Integer
'使用
Dim instance As IVsHasRelatedSaveItems
Dim saveItem As VSSAVETREEITEM
Dim celt As UInteger
Dim rgSaveTreeItems As VSSAVETREEITEM()
Dim pcActual As UInteger
Dim returnValue As Integer

returnValue = instance.GetRelatedSaveTreeItems(saveItem, _
    celt, rgSaveTreeItems, pcActual)
int GetRelatedSaveTreeItems(
    VSSAVETREEITEM saveItem,
    uint celt,
    VSSAVETREEITEM[] rgSaveTreeItems,
    out uint pcActual
)
int GetRelatedSaveTreeItems(
    [InAttribute] VSSAVETREEITEM saveItem, 
    [InAttribute] unsigned int celt, 
    [OutAttribute] array<VSSAVETREEITEM>^ rgSaveTreeItems, 
    [OutAttribute] unsigned int% pcActual
)
function GetRelatedSaveTreeItems(
    saveItem : VSSAVETREEITEM, 
    celt : uint, 
    rgSaveTreeItems : VSSAVETREEITEM[], 
    pcActual : uint
) : int

Parameters

  • celt
    Type: System.UInt32

    [in] Zero or the number of items in rgSaveTreeItems. See Remarks.

  • rgSaveTreeItems
    Type: []

    [in, out] Pointer to an array of VSSAVETREEITEM structures containing information about related items to save.

  • pcActual
    Type: System.UInt32%

    [out] Pointer to an integer that is the number of related items to save or the number of elements in rgSaveTreeItems.

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 vsshell80.idl:

HRESULT GetRelatedSaveTreeItems(
    [in] VSSAVETREEITEM saveItem,
    [in] ULONG celt,
    [in, out, size_is(celt)] VSSAVETREEITEM rgSaveTreeItems[],
    [out] ULONG *pcActual
);

Notes for Implementers

The method can return either the number of related save items, or it can return information about the related save items. The method returns the number of VSSAVETREEITEM items in pcActual if celt is zero and pcActual is not a null reference (Nothing in Visual Basic).

注意

If celt is not zero, rgSaveTreeItems must not be a null reference (Nothing in Visual Basic).

This behavior yields a common pattern of finding the number of related items and then retrieving information about the items, as in the following code. The code omits error checking for readability.

hr = pIVsHasRelatedSaveItems->GetRelatedSaveTreeItems(saveItem, 
        0, NULL, &cExpected);
prgSaveTreeItems = ::CoTaskMemAlloc(
        cExpected * sizeof(VSSAVETREEITEM));
hr = pIVsHasRelatedSaveItems->GetRelatedSaveTreeItems(saveItem,
        cExpected, prgSaveTreeItems, &cActual);

Permissions

See Also

Reference

IVsHasRelatedSaveItems Interface

IVsHasRelatedSaveItems Members

Microsoft.VisualStudio.Shell.Interop Namespace