IDiaEnumInputAssemblyFiles

枚举数据源中列出的输入程序集文件。

语法

IDiaEnumInputAssemblyFiles : IUnknown

Vtable 顺序中的方法

下表显示了 IDiaEnumInputAssemblyFiles 方法。

方法 说明
IDiaEnumInputAssemblyFiles::get__NewEnum 检索该枚举器的 IEnumVARIANT Interface 版本。
IDiaEnumInputAssemblyFiles::get_Count 检索输入程序集文件的数目。
IDiaEnumInputAssemblyFiles::Item 通过索引检索输入程序集文件。
IDiaEnumInputAssemblyFiles::Next 检索枚举序列中的指定数量的输入程序集文件。
IDiaEnumInputAssemblyFiles::Skip 跳过枚举序列中的指定数量的输入程序集文件。
IDiaEnumInputAssemblyFiles::Reset 将枚举序列重置到开头。
IDiaEnumInputAssemblyFiles::Clone 创建一个枚举器,其中包含与当前枚举器相同的枚举状态。

备注

对调用者的说明

通过调用具有特定源文件名称的 IDiaSession::findInputAssemblyFiles 方法或使用接口的全局唯一标识符(GUID)IDiaEnumInputAssemblyFiles调用 IDiaSession::getEnumTables 方法获取此接口。

示例

此示例演示如何获取(GetEnumInputAssemblyFiles 函数)和使用(DumpAllInputAssemblyFiles 函数)IDiaEnumInputAssemblyFiles 接口。 IDiaPropertyStorage请参阅函数实现的PrintPropertyStorage接口。 有关备用输出,请参阅 IDiaInputAssemblyFile 接口。


IDiaEnumInputAssemblyFiles* GetEnumInputAssemblyInputFiles(IDiaSession *pSession)
{
    IDiaEnumInputAssemblyFiles* pUnknown    = NULL;
    REFIID                   iid         = __uuidof(IDiaEnumInputAssemblyFiles);
    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 DumpAllInputAssemblyFiles( IDiaSession* pSession)
{
    IDiaEnumInputAssemblyFiles* pEnumInpAsmFiles;

    pEnumInpAsmFiles = GetEnumInputAssemblyInputFiles(pSession);
    if (pEnumInpAsmFiles != NULL)
    {
        IDiaInputAssemblyFile* pInpAsmFile;
        ULONG celt = 0;

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

要求

标头:Dia2.h

库:diaguids.lib

DLL:msdia140.dll

另请参阅