IDebugPendingBreakpoint2::Enable
切換暫止中斷點的啟用的狀態。
HRESULT Enable(
BOOL fEnable
);
int Enable(
int fEnable
);
參數
- fEnable
[in]設定為非零值 (TRUE) 來啟用暫止中斷點,或為零 (FALSE) 若要停用。
傳回值
如果成功的話,會傳回S_OK。 否則,會傳回錯誤碼。 傳回E_BP_DELETED如果已刪除中斷點。
備註
暫止中斷點是啟用或停用時,繫結從它的所有中斷點會都設定為相同的狀態中。
可能會視需要多次呼叫這個方法,即使已啟用或停用中斷點。
範例
下列範例會示範如何實作這個方法,如CPendingBreakpoint物件,公開 (expose) IDebugPendingBreakpoint2介面。
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;
}