IVsObjectList2.GetText(UInt32, VSTREETEXTOPTIONS, String) 方法

定义

返回一个指针,该指针指向请求的树列表项的文本表示形式。

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

参数

index
UInt32

中指定感兴趣的项的从零开始的索引。

tto
VSTREETEXTOPTIONS

中指定所请求的文本类型。 值取自 VSTREETEXTOPTIONS 枚举。

ppszText
String

弄指向指定树列表项中的文本字符串的指针。 实现者必须分配此字符串,并根据以下备注使指针保持有效。

返回

Int32

如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。

注解

COM 签名

从 vsshell80:

[C++]

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

此方法返回一个字符串,其中包含树列表项的各种文本元素。 返回的字符串在 TTO_SORTTEXT 列表的生存期内必须保持有效且不变,因为它们用于持续对列表进行排序和重新排序。 其他 VSTREETEXTOPTIONS 枚举值的字符串只需保持原样,直到下一 GetText 次调用时,在这种情况下,它们可能会被丢弃或重复使用。

如果要 IVsObjectList2 在托管代码中实现接口,且需要由调用方释放字符串,请 IVsCoTaskMemFreeMyStrings 在接口上实现接口 IVsObjectList2

适用于