Compartilhar via


IVsObjectList.GetText(UInt32, VSTREETEXTOPTIONS, String) Method

Definition

Returns a pointer to the text representations for the requested tree list item.

public:
 int GetText(System::UInt32 index, Microsoft::VisualStudio::Shell::Interop::VSTREETEXTOPTIONS tto, [Runtime::InteropServices::Out] System::String ^ % ppszText);
int GetText(unsigned int index, Microsoft::VisualStudio::Shell::Interop::VSTREETEXTOPTIONS tto, [Runtime::InteropServices::Out] std::wstring const & & ppszText);
public int GetText (uint index, Microsoft.VisualStudio.Shell.Interop.VSTREETEXTOPTIONS tto, out string ppszText);
abstract member GetText : uint32 * Microsoft.VisualStudio.Shell.Interop.VSTREETEXTOPTIONS * string -> int
Public Function GetText (index As UInteger, tto As VSTREETEXTOPTIONS, ByRef ppszText As String) As Integer

Parameters

index
UInt32

[in] Specifies the zero based index of the item of interest.

tto
VSTREETEXTOPTIONS

[in] Specifies the text type being requested. Values are taken from the VSTREETEXTOPTIONS enumeration.

ppszText
String

[out] Pointer to a text string from the specified tree list item. Implementers must allocate this string and keep the pointer valid as per the remarks below.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::GetText(  
   [in] ULONG Index,  
   [in] VSTREETEXTOPTIONS tto,  
   [out] const WCHAR **ppszText  
);  

This method returns a pointer to a string containing various text elements for the tree list item. String pointers returned for TTO_SORTTEXT must remain valid and unchanged for the lifetime of the list as they are used to continually sort and resort the list. String pointers for other VSTREETEXTOPTIONS enumeration values only need to remain intact until the next GetText call, at which time they may be discarded or reused.

If you are implementing the IVsObjectList interface in managed code and you need to have the string disposed by the caller, implement the IVsCoTaskMemFreeMyStrings interface on the IVsObjectList interface.

Applies to