次の方法で共有


IDiaSourceFile

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

[このトピックはプレリリース版のため将来変更される可能性があります。また、プレースホルダとしてブランクのトピックが含まれています。]

Represents a source file.

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

Interfaces (Debug Interface Access SDK)
IDiaEnumSourceFiles::Item
IDiaEnumSourceFiles::Next
IDiaLineNumber::get_sourceFile
IDiaSession::findFileById
IDiaSession::findLines
IDiaSession::findLinesByLinenum