IDebugPendingBreakpoint2:: 启用

切换挂起的断点的启用状态。

HRESULT Enable( 
   BOOL fEnable
);
int Enable( 
   int fEnable
);

参数

  • fEnable
    [in] 设置为非零 (TRUE) 启用挂起的断点或零 (FALSE) 禁用。

返回值

如果成功,则返回; S_OK否则,返回错误代码。 ,如果断点删除,返回 E_BP_DELETED 。

备注

当挂起的断点已启用或禁用时,从其绑定到的所有断点设置为相同的状态。

此方法会根据需要多次调用,因此,即使断点已启用或禁用。

示例

下面的示例演示如何执行显示 IDebugPendingBreakpoint2 接口的简单 CPendingBreakpoint 对象的方法。

HRESULT CPendingBreakpoint::Enable(BOOL fEnable)  
{  
   HRESULT hr;  
  
   // Verify that the pending breakpoint has not been deleted. If deleted, 
   // then return hr = E_BP_DELETED.  
   if (m_state.state != PBPS_DELETED)  
   {  
      // If the bound breakpoint member variable is valid, then enable or 
      // disable the bound breakpoint.  
      if (m_pBoundBP)  
      {  
         m_pBoundBP->Enable(fEnable);  
      }  
      // Set the PENDING_BP_STATE in the PENDING_BP_STATE_INFO structure 
      // to enabled or disabled depending on the passed BOOL condition.  
      m_state.state = fEnable ? PBPS_ENABLED : PBPS_DISABLED;  
      hr = S_OK;  
  
   }  
   else  
   {  
      hr = E_BP_DELETED;  
   }  
  
   return hr;  
}  

请参见

参考

IDebugPendingBreakpoint2