IDiaSourceFile

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Represents a source file.

Syntax

IDiaSourceFile : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaSourceFile.

Method Description
IDiaSourceFile::get_uniqueId Retrieves a simple integer key value that is unique for this image.
IDiaSourceFile::get_fileName Retrieves the source file name.
IDiaSourceFile::get_checksumType Retrieves the checksum type.
IDiaSourceFile::get_compilands Retrieves an enumerator of the compilands with line numbers referencing this file.
IDiaSourceFile::get_checksum Retrieves the checksum bytes.

Remarks

Notes for Callers

Obtain this interface by calling the IDiaEnumSourceFiles::Item or IDiaEnumSourceFiles::Next methods. See the example for details.

Example

This function displays the names of all source files contributing to the specified table.

void ShowSourceFiles(IDiaTable *pTable)
{
    CComPtr<IDiaEnumSourceFiles> pSourceFiles;
    if ( SUCCEEDED( pTable->QueryInterface(
                                _uuidof( IDiaEnumSourceFiles ),
                               (void**)&pSourceFiles )
                  )
       )
    {
        CComPtr<IDiaSourceFile> pSourceFile;
        while ( SUCCEEDED( hr = pSourceFiles->Next( 1, &pSourceFile, &celt ) ) &&
                celt == 1 )
        {
            CDiaBSTR fileName;
            if ( pSourceFile->get_fileName( &fileName) == S_OK )
            {
                printf( "file name: %ws\n", fileName );
            }
            pSourceFile = NULL;
        }
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also