IVsHasRelatedSaveItems::GetRelatedSaveTreeItems Method (VSSAVETREEITEM, UInt32, array<VSSAVETREEITEM>^, UInt32)
Gets the number of related items to save, or returns a list of related items to save.
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)
int GetRelatedSaveTreeItems( VSSAVETREEITEM saveItem, unsigned int celt, array<VSSAVETREEITEM>^ rgSaveTreeItems, [OutAttribute] unsigned int% pcActual )
Parameters
- saveItem
-
Type:
Microsoft.VisualStudio.Shell.Interop::VSSAVETREEITEM
[in] Pointer to a VSSAVETREEITEM structure containing information about the item to check for related items.
- celt
-
Type:
System::UInt32
[in] Zero or the number of items in rgSaveTreeItems. See Remarks.
- rgSaveTreeItems
-
Type:
array<Microsoft.VisualStudio.Shell.Interop::VSSAVETREEITEM>^
[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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From vsshell80.idl:
HRESULT GetRelatedSaveTreeItems( [in] VSSAVETREEITEM saveItem, [in] ULONG celt, [in, out, size_is(celt)] VSSAVETREEITEM rgSaveTreeItems[], [out] ULONG *pcActual );
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);
