共用方式為


IDebugCodeContext2::GetDocumentContext

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

Gets the document context that corresponds to this code context. The document context represents a position in the source file that corresponds to the source code that generated this instruction.

Syntax

HRESULT GetDocumentContext( 
   IDebugDocumentContext2** ppSrcCxt
);
int GetDocumentContext( 
   out IDebugDocumentContext2 ppSrcCxt
);

Parameters

ppSrcCxt
[out] Returns the IDebugDocumentContext2 object that corresponds to the code context. If S_OK is returned, ths should be non-null.

Return Value

If successful, returns S_OK; otherwise, returns an error code. A debug engine should return a failure code such as E_FAIL when the out parameter is null such as when the code context has no associated source position.

Remarks

Generally, the document context can be thought of as a position in a source file while the code context is a position of a code instruction in an execution stream.

See also