Skip to content

Latest commit

 

History

History
85 lines (72 loc) · 2.16 KB

idebugpendingbreakpoint2-enable.md

File metadata and controls

85 lines (72 loc) · 2.16 KB
description title ms.date ms.topic f1_keywords helpviewer_keywords author ms.author manager ms.subservice dev_langs
Toggles the enabled state of the pending breakpoint.
IDebugPendingBreakpoint2::Enable
11/04/2016
reference
IDebugPendingBreakpoint2::Enable
IDebugPendingBreakpoint2::Enable method
Enable method
maiak
maiak
mijacobs
debug-diagnostics
CPP
CSharp

IDebugPendingBreakpoint2::Enable

Toggles the enabled state of the pending breakpoint.

Syntax

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

Parameters

fEnable
[in] Set to nonzero (TRUE) to enable a pending breakpoint, or to zero (FALSE) to disable.

Return Value

If successful, returns S_OK; otherwise, returns an error code. Returns E_BP_DELETED if the breakpoint has been deleted.

Remarks

When a pending breakpoint is enabled or disabled, all breakpoints bound from it are set to the same state.

This method may be called as many times as necessary, even if the breakpoint is already enabled or disabled.

Example

The following example shows how to implement this method for a simple CPendingBreakpoint object that exposes the IDebugPendingBreakpoint2 interface.

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

See also