Compartir a través de


IDebugPendingBreakpoint2::Enable

Alterna el estado habilitado del punto de interrupción pendiente.

Sintaxis

int Enable(
    int fEnable
);

Parámetros

fEnable
[in] Establezca en distinto de cero (TRUE) para habilitar un punto de interrupción pendiente o en cero (FALSE) para deshabilitar.

Valor devuelto

Si la operación se realiza correctamente, devuelve S_OK; de lo contrario, devuelve un código de error. Devuelve E_BP_DELETED si se ha eliminado el punto de interrupción.

Comentarios

Cuando se habilita o deshabilita un punto de interrupción pendiente, todos los puntos de interrupción enlazados desde él se establecen en el mismo estado.

Se puede llamar a este método tantas veces como sea necesario, incluso si el punto de interrupción ya está habilitado o deshabilitado.

Ejemplo

En el ejemplo siguiente se muestra cómo implementar este método para un objeto simple CPendingBreakpoint que expone la interfaz 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;
}

Consulte también