共用方式為


IDebugPendingBreakpoint2::Enable

 

如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件

切換暫止中斷點的啟用的狀態。

語法

HRESULT Enable(   
   BOOL fEnable  
);  
int Enable(   
   int fEnable  
);  

參數

fEnable
[in]設定為非零 (TRUE) 若要啟用暫止中斷點,或為零 (FALSE) 若要停用。

傳回值

如果成功,傳回S_OK; 否則傳回錯誤碼。 傳回E_BP_DELETED若已刪除中斷點。

備註

暫止中斷點是啟用或停用時,它從繫結的所有中斷點都會都設定相同的狀態。

可能會視需要多次呼叫這個方法,即使已啟用或停用中斷點。

範例

下列範例示範如何實作這種簡單的方式CPendingBreakpoint公開物件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;    
}    

另請參閱

IDebugPendingBreakpoint2