IDiaEnumDebugStreams::Item

通过索引或名称检索调试流。

语法

HRESULT Item (
    VARIANT                   index,
    IDiaEnumDebugStreamData** stream
);

参数

索引

[in] 要检索的调试流的索引或名称。 如果使用整数变体,则它必须在 0 到 count-1 范围内,其中 countIDiaEnumDebugStreams::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);
}

另请参阅