IDebugDocumentContext2:: GetStatementRange

获取文档上下文的文件语句之间。

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

参数

  • pBegPosition
    [in, out] 创建一个起始位置填充的 TEXT_POSITION 结构。 ,如果此信息不是必需的,将此参数设置为空值。

  • pEndPosition
    [in, out] 在结束位置填充的 TEXT_POSITION 结构。 ,如果此信息不是必需的,将此参数设置为空值。

返回值

如果成功,则返回; S_OK否则,返回错误代码。

备注

语句之间是提供代码文档上下文引用行的大小。

若要获取源代码的大小 (包括注释) 中文档上下文,调用 IDebugDocumentContext2:: GetSourceRange 方法。

示例

下面的示例演示如何执行显示 IDebugDocumentContext2 接口的简单 CDebugContext 对象的方法。 ,仅当开始位置不是 null 值,此示例填充结束位置。

HRESULT CDebugContext::GetStatementRange(TEXT_POSITION* pBegPosition,
                                         TEXT_POSITION* pEndPosition)  
{  
   HRESULT hr;  
  
   // Check for a valid beginning position argument pointer.  
   if (pBegPosition)  
   {  
      // Copy the member TEXT_POSITION into the local pBegPosition.  
      memcpy(pBegPosition, &m_pos, sizeof (TEXT_POSITION));  
        
      // Check for a valid ending position argument pointer. 
     if (pEndPosition)  
      {  
         // Copy the member TEXT_POSITION into the local pEndPosition.  
         memcpy(pEndPosition, &m_pos, sizeof (TEXT_POSITION));  
      }  
      hr = S_OK;  
   }  
   else  
   {  
      hr = E_INVALIDARG;  
   }  
  
   return hr;  
}  

请参见

参考

IDebugDocumentContext2

IDebugDocumentContext2:: GetSourceRange

TEXT_POSITION