Debugger3 Interface
Debugger3 is used to interrogate and manipulate the state of the debugger and the program being debugged. Debugger3 supersedes the Debugger2 and Debugger interfaces.
Namespace: EnvDTE90
Assembly: EnvDTE90 (in EnvDTE90.dll)
Syntax
'Declaration
<GuidAttribute("87DFC8DA-67B4-4954-BB89-6A277A50BAFC")> _
Public Interface Debugger3 _
Inherits Debugger2
'Usage
Dim instance As Debugger3
[GuidAttribute("87DFC8DA-67B4-4954-BB89-6A277A50BAFC")]
public interface Debugger3 : Debugger2
[GuidAttribute(L"87DFC8DA-67B4-4954-BB89-6A277A50BAFC")]
public interface class Debugger3 : Debugger2
public interface Debugger3 extends Debugger2
Remarks
The debugger is available through the DTE2 object through its Debugger property, as shown in the following example. One debugger object is available for each instance of the interactive development environment (IDE).
Examples
Imports System
Imports EnvDTE
Imports EnvDTE90
Imports EnvDTE90
Imports System.Diagnostics
Public Module Module1
'This function returns true if the debugger is actively debugging.
Function IsDebugging() As Boolean
Dim debugger As EnvDTE90.Debugger3
debugger = DTE.Debugger
If (debugger Is Nothing) Then
MsgBox("Debugger doesn't exist! Fatal error.")
IsDebugging = false
Else
IsDebugging = (debugger.CurrentMode <> _
dbgDebugMode.dbgDesignMode)
End If
End Function
End Module
// The following C++ program can be run from the command line.
// It detects whether an instance of Visual Studio is currently
// running,and if so, prints a message stating whether its debugger
// is actively debugging.
#include <stdio.h>
#import "dte90.olb" raw_interfaces_only named_guids
using namespace EnvDTE90;
int main(void)
{
int nRet = 0;
CoInitialize(NULL);
IUnknownPtr pUnk;
GetActiveObject(CLSID_DTE, NULL, &pUnk);
if (pUnk == NULL) {
printf ("No instance of Visual Studio is running.\n");
}
else {
_DTEPtr pDTE = pUnk;
if (pDTE) {
DebuggerPtr pDebugger;
if (SUCCEEDED(pDTE->get_Debugger(&pDebugger3)) &&
pDebugger3
!= NULL){
dbgDebugMode mode;
if (SUCCEEDED(pDebugger3->get_CurrentMode(&mode))) {
if (mode != dbgDesignMode) {
printf("Debugger is active.\n");
nRet = 1;
}
else {
printf("Debugger is not active.\n");
}
}
}
}
}
CoUninitialize();
return nRet;
}