通过索引或名称检索调试流。
HRESULT Item (
VARIANT index,
IDiaEnumDebugStreamData** stream
);
参数
Index — 索引
[in] 要检索的调试流的索引或名称。 如果使用整数变量,它必须在范围 count0 到 -1,其中 count 为返回的 IDiaEnumDebugStreams::get_Count 方法。Stream — 流
[out] 返回表示的 IDiaEnumDebugStreamData 对象指定调试流。
返回值
如果成功,则返回; S_OK否则,返回错误代码。
示例
IDiaEnumDebugStreamData *GetStreamData(IDiaEnumDebugStreams *pStreamList,
LONG whichStream)
{
IDiaEnumDebugStreamData *pStreamData = NULL;
if (pStreamList != NULL)
{
LONG numStreams = 0;
if (pStreamList->get_count(&numStreams) == S_OK &&
whichStream >= 0 && whichStream < numStreams)
{
VARIANT vIndex;
vIndex.vt = VT_I4;
vIndex.lVal = whichStream;
if (pStreamList->Item(vIndex,&pStreamData) != S_OK)
{
std::cerr << "Error retrieving stream " << whichStream << std::endl;
}
}
}
return(pStreamData);
}