次の方法で共有


IDiaEnumDebugStreams::Item

インデックスや名前を利用してデバッグ ストリームを取得します。

構文

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

パラメーター

index

[入力] 取得するデバッグ ストリームのインデックスまたは名前。 整数バリアントが使用される場合、それは 0 から count-1 までの範囲に含まれる必要があります。count は、IDiaEnumDebugStreams::get_Count メソッドによって返されるものです。

ストリーム (stream)

[出力] 指定のデバッグ ストリームを表す 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);
}

関連項目