IVsHasRelatedSaveItems.GetRelatedSaveTreeItems Method

Definition

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

public:
 int GetRelatedSaveTreeItems(Microsoft::VisualStudio::Shell::Interop::VSSAVETREEITEM saveItem, System::UInt32 celt, cli::array <Microsoft::VisualStudio::Shell::Interop::VSSAVETREEITEM> ^ rgSaveTreeItems, [Runtime::InteropServices::Out] System::UInt32 % pcActual);
int GetRelatedSaveTreeItems(Microsoft::VisualStudio::Shell::Interop::VSSAVETREEITEM saveItem, unsigned int celt, std::Array <Microsoft::VisualStudio::Shell::Interop::VSSAVETREEITEM> const & rgSaveTreeItems, [Runtime::InteropServices::Out] unsigned int & pcActual);
public int GetRelatedSaveTreeItems (Microsoft.VisualStudio.Shell.Interop.VSSAVETREEITEM saveItem, uint celt, Microsoft.VisualStudio.Shell.Interop.VSSAVETREEITEM[] rgSaveTreeItems, out uint pcActual);
abstract member GetRelatedSaveTreeItems : Microsoft.VisualStudio.Shell.Interop.VSSAVETREEITEM * uint32 * Microsoft.VisualStudio.Shell.Interop.VSSAVETREEITEM[] * uint32 -> int
Public Function GetRelatedSaveTreeItems (saveItem As VSSAVETREEITEM, celt As UInteger, rgSaveTreeItems As VSSAVETREEITEM(), ByRef pcActual As UInteger) As Integer

Parameters

saveItem
VSSAVETREEITEM

[in] Pointer to a VSSAVETREEITEM structure containing information about the item to check for related items.

celt
UInt32

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

rgSaveTreeItems
VSSAVETREEITEM[]

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

pcActual
UInt32

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

Returns

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 null.

Note

If celt is not zero, rgSaveTreeItems must not be null.

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);  

Applies to