Freigeben über


IDebugBoundBreakpoint2::Aktivieren

Aktiviert oder deaktiviert den Haltepunkt.

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

Parameter

  • fEnable
    [in] Position zu aktivierenTRUEals ungleich 0 (Null) oder (FALSE), um den Haltepunkten zu deaktivieren.

Rückgabewert

Bei Erfolg gibt S_OKzurück. andernfalls gibt einen Fehlercode zurück. Gibt E_BP_DELETED zurück, wenn sich der Zustand des Objekts BPS_DELETED gebundenen Haltepunkt festgelegt ist (Teil der BP_STATE-Enumeration).

Beispiel

Im folgenden Beispiel wird veranschaulicht, wie diese Methode für ein einfaches CBoundBreakpoint-Objekt implementiert, das die IDebugBoundBreakpoint2-Schnittstelle verfügbar macht.

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

Siehe auch

Referenz

IDebugBoundBreakpoint2

BP_STATE