Partager via


IDiaEnumSymbols

Enumerates the various symbols contained in the data source.

IDiaEnumSymbols : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaEnumSymbols.

Method

Description

IDiaEnumSymbols::get__NewEnum

Retrieves the IEnumVARIANT Interface version of this enumerator.

IDiaEnumSymbols::get_Count

Retrieves the number of symbols.

IDiaEnumSymbols::Item

Retrieves a symbol by means of an index.

IDiaEnumSymbols::Next

Retrieves a specified number of symbols in the enumeration sequence.

IDiaEnumSymbols::Skip

Skips a specified number of symbols in an enumeration sequence.

IDiaEnumSymbols::Reset

Resets an enumeration sequence to the beginning.

IDiaEnumSymbols::Clone

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

Remarks

This interface provides symbols grouped by a specific type of symbol, for example, SymTagUDT (user-defined types) or SymTagBaseClass. To work with symbols grouped by address, use the IDiaEnumSymbolsByAddr interface.

Notes for Callers

Obtain this interface by calling the following methods:

Example

This example shows how to obtain the IDiaEnumSymbols interface and then use that enumeration to list user-defined types (UDTs).

Note

CDiaBSTR is a class that wraps a BSTR and automatically handles freeing the string when the instantiation goes out of scope.

void ShowUDTs(IDiaSymbol *pGlobals)
{
    CComPtr<IDiaEnumSymbols> pEnum;
    CComPtr<IDiaSymbol> pSymbol;
    HRESULT hr;

    hr = pGlobals->findChildren(SymTagUDT,
                                NULL,
                                nsfCaseInsensitive | nsfUndecoratedName,
                                &pEnum);
    if (hr == S_OK)
    {
        while ( SUCCEEDED( hr = pEnum->Next( 1, &pSymbol, &celt ) ) &&
                celt == 1 )
        {
            CDiaBSTR name;
            if ( pSymbol->get_name( &name ) != S_OK )
                Fatal( "get_name" );
            printf( "Found UDT: %ws\n", name );
            pSymbol = 0;
        }
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See Also

Reference

IDiaSession::findChildren

IDiaSourceFile::get_compilands

IDiaSymbol::findChildren

Other Resources

Interfaces (Debug Interface Access SDK)