IDebugPendingBreakpoint2::Enable
切换挂起断点的启用状态。
语法
参数
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;
}