Share via


IDiaEnumInjectedSources

Enumerate the various injected sources contained in the data source.

IDiaEnumInjectedSources : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaEnumInjectedSources.

Method

Description

IDiaEnumInjectedSources::get__NewEnum

Retrieves the IEnumVARIANT Interface version of this enumerator.

IDiaEnumInjectedSources::get_Count

Retrieves the number of injected sources.

IDiaEnumInjectedSources::Item

Retrieves an injected source by means of an index.

IDiaEnumInjectedSources::Next

Retrieves a specified number of injected sources in the enumeration sequence.

IDiaEnumInjectedSources::Skip

Skips a specified number of injected sources in an enumeration sequence.

IDiaEnumInjectedSources::Reset

Resets an enumeration sequence to the beginning.

IDiaEnumInjectedSources::Clone

Creates an enumerator that contains the same enumeration state as the current enumerator.

Remarks

Notes for Callers

This interface is obtained by calling the IDiaSession::findInjectedSource method with the name of a specific source file or by calling the IDiaSession::getEnumTables method with the GUID of the IDiaEnumInjectedSources interface.

Example

This example shows how to obtain (the GetEnumInjectedSources function) and use (the DumpAllInjectedSources function) the IDiaEnumInjectedSources interface. See the IDiaPropertyStorage interface for an implementation of the PrintPropertyStorage function. For an alternative output, see the IDiaInjectedSource interface.

 
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();
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See Also

Reference

IDiaSession::findInjectedSource

IDiaSession::getEnumTables

IDiaPropertyStorage

IDiaInjectedSource

Other Resources

Interfaces (Debug Interface Access SDK)