共用方式為


Debugger3.CurrentMode Property

Definition

Gets the current mode of the debugger within the context of the IDE.

public:
 property EnvDTE::dbgDebugMode CurrentMode { EnvDTE::dbgDebugMode get(); };
public:
 property EnvDTE::dbgDebugMode CurrentMode { EnvDTE::dbgDebugMode get(); };
[System.Runtime.InteropServices.DispId(102)]
public EnvDTE.dbgDebugMode CurrentMode { [System.Runtime.InteropServices.DispId(102)] get; }
[<System.Runtime.InteropServices.DispId(102)>]
[<get: System.Runtime.InteropServices.DispId(102)>]
member this.CurrentMode : EnvDTE.dbgDebugMode
Public ReadOnly Property CurrentMode As dbgDebugMode

Property Value

A dbgDebugMode value.

Implements

Attributes

Examples

The following example shows how to use the CurrentMode property.

public static void CurrentMode(EnvDTE80.DTE2 dte)  
{  
    // Setup debug Output window.  
    Window w = _  
      (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);  
    w.Visible = true;  
    OutputWindow ow = (OutputWindow)w.Object;  
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Current Mode");  
    owp.Activate();  

    owp.OutputString("Current Mode: ");  

    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;  

    switch (debugger.CurrentMode)  
    {  
        case dbgDebugMode.dbgDesignMode:  
            owp.OutputString("Design Mode");  
            break;  
        case dbgDebugMode.dbgBreakMode:  
            owp.OutputString("Break Mode");  
            break;  
        case dbgDebugMode.dbgRunMode:  
            owp.OutputString("Run Mode");  
            break;  
    }  
}  
Sub DebuggerMode()  
    ' This function displays the current debugger mode in a new  
    ' pane in the Output window.  
    Dim ow As OutputWindow  
    ow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object  

    Dim bppane As OutputWindowPane  
    bppane = ow.OutputWindowPanes.Add("Debugger")  

    Select Case dte.Debugger3.CurrentMode  
        Case dbgDebugMode.dbgBreakMode  
            bppane.OutputString("Break Mode" + vbCrLf)  
        Case dbgDebugMode.dbgDesignMode  
            bppane.OutputString("Design Mode" + vbCrLf)  
        Case dbgDebugMode.dbgRunMode  
            bppane.OutputString("Run Mode" + vbCrLf)  
    End Select  
End Sub  

Applies to