保留中のブレークポイントの有効化状態を切り替えます。
構文
パラメーター
fEnable
[入力] 保留中のブレークポイントを有効にする場合はゼロ以外 (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;
}