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;
}