共用方式為


IDebugDocumentPosition2::GetRange

Gets the range for this document position.

HRESULT GetRange( 
   TEXT_POSITION* pBegPosition,
   TEXT_POSITION* pEndPosition
);
int GetRange( 
   TEXT_POSITION[] pBegPosition,
   TEXT_POSITION[] pEndPosition
);

Parameters

  • pBegPosition
    [in, out] A TEXT_POSITION structure that is filled in with the starting position. Set this argument to a null value if this information is not needed.

  • pEndPosition
    [in, out] A TEXT_POSITION structure that is filled in with the ending position. Set this argument to a null value if this information is not needed.

Return Value

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

Remarks

The range specified in a document position for a location breakpoint is used by the debug engine (DE) to search ahead for a statement that actually contributes code. For example, consider the following code:

Line 5: // comment
Line 6: x = 1;

Line 5 contributes no code to the program being debugged. If the debugger that sets the breakpoint on line 5 wants the DE to search forward a certain amount for the first line that contributes code, the debugger would specify a range that includes additional candidate lines where a breakpoint might be properly placed. The DE would then search forward through those lines until it found a line that could accept a breakpoint.

See Also

Reference

IDebugDocumentPosition2

TEXT_POSITION