IDebugBoundBreakpoint2::Enable
중단점을 사용하거나 사용하지 않도록 설정합니다.
구문
매개 변수
fEnable
[in] 중단점을 사용하도록 설정하려면 0이 아닌 값(TRUE
)으로 설정하고, 중단점을 사용하지 않도록 설정하려면 0(FALSE
)으로 설정합니다.
Return Value
성공하면 S_OK
를 반환하고, 실패하면 오류 코드를 반환합니다. 바인딩된 중단점 개체의 상태가 BPS_DELETED
(BP_STATE 열거형의 일부)로 설정되어 있으면 E_BP_DELETED
를 반환합니다.
예시
다음 예제에서는 IDebugBoundBreakpoint2 인터페이스를 노출하는 간단한 CBoundBreakpoint
개체에 대해 이 메서드를 구현하는 방법을 보여 줍니다.
HRESULT CBoundBreakpoint::Enable(BOOL fEnable)
{
HRESULT hr;
// Verify that the bound breakpoint has not been deleted. If deleted,
// then return hr = E_BP_DELETED.
if (m_state != BPS_DELETED)
{
// Check the state of the bound breakpoint. If the breakpoint is
// supposed to be, but has not already been, enabled, then have the
// interpreter set the breakpoint.
if (fEnable && m_state != BPS_ENABLED)
{
hr = m_pInterp->SetBreakpoint(m_sbstrDoc, this);
if (hr == S_OK)
{
// Change the state of the breakpoint to BPS_ENABLED.
m_state = BPS_ENABLED;
}
}
// Check the state of the bound breakpoint. If the breakpoint is
// supposed to be, but has not already been, disabled, then have the
// interpreter remove the breakpoint.
else if (!fEnable && m_state != BPS_DISABLED)
{
hr = m_pInterp->RemoveBreakpoint(m_sbstrDoc, this);
if (hr == S_OK)
{
// Change the state of the breakpoint to BPS_DISABLED.
m_state = BPS_DISABLED;
}
}
else
{
hr = S_FALSE;
}
}
else
{
hr = E_BP_DELETED;
}
return hr;
}