IDebugBoundBreakpoint2::EnableIDebugBoundBreakpoint2::Enable

Habilita o deshabilita el punto de interrupción.Enables or disables the breakpoint.

SintaxisSyntax

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

ParámetrosParameters

fEnable
[in] Establecer a distinto de cero (TRUE) para habilitar o cero (FALSE) para deshabilitar el punto de interrupción.[in] Set to non-zero (TRUE) to enable or to zero (FALSE) to disable the breakpoint.

Valor devueltoReturn Value

Si se realiza correctamente, devuelve S_OK; en caso contrario, devuelve un código de error.If successful, returns S_OK; otherwise, returns an error code. Devuelve E_BP_DELETED si se establece el estado del objeto de punto de interrupción enlazado en BPS_DELETED (parte de la BP_STATE enumeración).Returns E_BP_DELETED if the state of the bound breakpoint object is set to BPS_DELETED (part of the BP_STATE enumeration).

EjemploExample

En el ejemplo siguiente se muestra cómo implementar este método para un sencillo CBoundBreakpoint objeto que expone la IDebugBoundBreakpoint2 interfaz.The following example shows how to implement this method for a simple CBoundBreakpoint object that exposes the IDebugBoundBreakpoint2 interface.

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

Vea tambiénSee Also

IDebugBoundBreakpoint2 IDebugBoundBreakpoint2
BP_STATEBP_STATE