IDiaEnumInjectedSources

枚举数据源包含的各种插入的源。

IDiaEnumInjectedSources : IUnknown

方法按 Vtable 顺序

下表显示 IDiaEnumInjectedSources方法。

方法

说明

IDiaEnumInjectedSources::get__NewEnum

检索此枚举器的 IEnumVARIANT Interface 版本。

IDiaEnumInjectedSources::get_Count

检索插入的源的数目。

IDiaEnumInjectedSources::Item

通过索引检索插入的源。

IDiaEnumInjectedSources::Next

检索插入的源指定数目的枚举序列的。

IDiaEnumInjectedSources::Skip

跳过插入的源指定数目的枚举序列的。

IDiaEnumInjectedSources::Reset

重置枚举序列与开头。

IDiaEnumInjectedSources::Clone

创建包含枚举状态和枚举当前枚举数相同的枚举数。

备注

调用方的说明

此接口通过调用获取 IDiaSession::findInjectedSource 方法与特定源文件的名称或通过调用 IDiaSession::getEnumTables 方法与 IDiaEnumInjectedSources 接口的 GUID。

示例

此示例演示如何获取 GetEnumInjectedSources (函数) 和使用 ( DumpAllInjectedSources 功能) IDiaEnumInjectedSources 接口。为 PrintPropertyStorage 函数的实现参见 IDiaPropertyStorage 接口。有关备用输出,请参见 IDiaInjectedSource 接口。

 
IDiaEnumInjectedSources* GetEnumInjectedSources(IDiaSession *pSession)
{
    IDiaEnumInjectedSources* pUnknown    = NULL;
    REFIID                   iid         = __uuidof(IDiaEnumInjectedSources);
    IDiaEnumTables*          pEnumTables = NULL;
    IDiaTable*               pTable      = NULL;
    ULONG                    celt        = 0;

    if (pSession->getEnumTables(&pEnumTables) != S_OK)
    {
        wprintf(L"ERROR - GetTable() getEnumTables\n");
        return NULL;
    }
    while (pEnumTables->Next(1, &pTable, &celt) == S_OK && celt == 1)
    {
        // There is only one table that matches the given iid
        HRESULT hr = pTable->QueryInterface(iid, (void**)&pUnknown);
        pTable->Release();
        if (hr == S_OK)
        {
            break;
        }
    }
    pEnumTables->Release();
    return pUnknown;
}


void DumpAllInjectedSources( IDiaSession* pSession)
{
    IDiaEnumInjectedSources* pEnumInjSources;

    pEnumInjSources = GetEnumInjectedSources(pSession);
    if (pEnumInjSources != NULL)
    {
        IDiaInjectedSource* pInjSource;
        ULONG celt = 0;

        while(pEnumInjSources->Next(1, &pInjSource, &celt) == S_OK &&
              celt == 1)
        {
            IDiaPropertyStorage *pPropertyStorage;
            if (pInjSource->QueryInterface(__uuidof(IDiaPropertyStorage),
                                           (void **)&pPropertyStorage) == S_OK)
            {
                PrintPropertyStorage(pPropertyStorage);
                pPropertyStorage->Release();
            }
            pInjSource->Release();
        }
        pEnumInjSources->Release();
    }
}

要求

标题:Dia2.h

库:diaguids.lib

DLL:msdia80.dll

请参见

参考

IDiaSession::findInjectedSource

IDiaSession::getEnumTables

IDiaPropertyStorage

IDiaInjectedSource

其他资源

接口(调试接口访问 SDK)