Share via


IDebugPendingBreakpoint2::Enable

Bascule l’état activé du point d’arrêt en attente.

Syntaxe

int Enable(
    int fEnable
);

Paramètres

fEnable
[in] Définissez sur différent de zéro (TRUE) pour activer un point d’arrêt en attente, ou sur zéro (FALSE) à désactiver.

Valeur de retour

En cas de réussite, retourne S_OK , sinon, retourne un code d'erreur. Retourne E_BP_DELETED si le point d’arrêt a été supprimé.

Notes

Lorsqu’un point d’arrêt en attente est activé ou désactivé, tous les points d’arrêt liés à celui-ci sont définis sur le même état.

Cette méthode peut être appelée autant de fois que nécessaire, même si le point d’arrêt est déjà activé ou désactivé.

Exemple

L’exemple suivant montre comment implémenter cette méthode pour un objet simple CPendingBreakpoint qui expose l’interface 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;
}

Voir aussi