共用方式為


IDiaSession::findFile

Note

This article applies to Visual Studio 2015. 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

Retrieves source files by compiland and name.

Syntax

HRESULT findFile (   
   IDiaSymbol*           pCompiland,  
   LPCOLESTR             name,  
   DWORD                 option,  
   IDiaEnumSourceFiles** ppResult  
);  

Parameters

pCompiland
[in] An IDiaSymbol object representing the compiland to be used as a context for the search. Set this parameter to NULL to find source files in all compilands.

name
[in] Specifies the name of the source file to be retrieved. Set this parameter to NULL for all source files to be retrieved.

option
[in] Specifies the comparison options applied to name searching. Values from the NameSearchOptions Enumeration enumeration can be used alone or in combination.

ppResult
[out] Returns an IDiaEnumSourceFiles object that contains a list of the source files retrieved.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Example

IDiaEnumSourceFiles* pEnum;  
pSession->findFile( NULL, L"sourcefile.cpp", nsFNameExt, &pEnum );  

See Also

IDiaEnumSourceFiles
IDiaSession
IDiaSymbol
NameSearchOptions Enumeration