IDiaEnumSectionContribs

Enumerates the various section contributions contained in the data source.

Syntax

IDiaEnumSectionContribs : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaEnumSectionContribs.

Method Description
IDiaEnumSectionContribs::get__NewEnum Retrieves the IEnumVARIANT Interface version of this enumerator.
IDiaEnumSectionContribs::get_Count Retrieves the number of section contributions.
IDiaEnumSectionContribs::Item Retrieves section contributions by means of an index.
IDiaEnumSectionContribs::Next Retrieves a specified number of section contributions in the enumeration sequence.
IDiaEnumSectionContribs::Skip Skips a specified number of section contributions in an enumeration sequence.
IDiaEnumSectionContribs::Reset Resets an enumeration sequence to the beginning.
IDiaEnumSectionContribs::Clone Creates an enumerator that contains the same enumeration state as the current enumerator.

Remarks

Note for Callers

Obtain this interface from the IDiaSession::getEnumTables method. See the example for details.

Example

This example shows how to obtain (the GetEnumSectionContribs function) and use (the ShowSectionContribs function) the IDiaEnumSectionContribs interface. For a more complete example of using section contributions, see the IDiaSectionContrib interface.


IDiaEnumSectionContribs* GetEnumSectionContribs(IDiaSession *pSession)
{
    IDiaEnumSectionContribs* pUnknown    = NULL;
    REFIID                   iid         = __uuidof(IDiaEnumSectionContribs);
    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 ShowSectionContribs(IDiaSession *pSession)
{
    IDiaEnumSectionContribs* pEnumSectionContribs;

    pEnumSectionContribs = GetEnumSectionContribs(pSession);
    if (pSectionContrib != NULL)
    {
        IDiaSectionContrib* pSectionContrib;
        ULONG celt = 0;

        while(pEnumSectionContribs->Next(1, &pSectionContrib, &celt) == S_OK &&
              celt == 1)
        {
            PrintSectionContrib(pSectionContrib, pSession);
            pSectionContrib->Release();
        }
        pSectionContrib->Release();
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also