Process.DTE Property

Gets the top-level extensibility object.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
    DTE^ get ();
}
abstract DTE : DTE with get
function get DTE () : DTE

Property Value

Type: EnvDTE.DTE
A DTE object.

Remarks

In Visual Studio, the DTE object is the root of the automation model, which other object models often name "Application."

Examples

The following example demonstrates how to use the DTE property.

To test this property

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

  3. When the application stops on the breakpoint, run the add-in.

public static void DTE(DTE 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("DTE Property Test");
    owp.Activate();
    owp.OutputString("\nEdition of the environment: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).DTE.Edition);
    owp.OutputString("\nThe name of the current program: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).Name);
    owp.OutputString("\nThe name of the current program: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).Parent.CurrentProgram.Name);
    owp.OutputString("\nProcess ID: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).ProcessID);
    EnvDTE.Programs programs = 
                        dte.Debugger.DebuggedProcesses.Item(1).Programs;
    owp.OutputString("\nThe name of the current program: " + 
                        programs.Item(1).Name);
}
Shared Sub DTE(ByRef dte As EnvDTE.DTE)
    Dim str As String
    Dim processes As EnvDTE.Processes = dte.Debugger.DebuggedProcesses
    str = "Edition of the environment: " + processes.Item(1).DTE.Edition
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Name
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Parent.CurrentProgram.Name
    str += vbCrLf + "Process ID: " + processes.Item(1).ProcessID.ToString()
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Programs.Item(1).Name
    MessageBox.Show(str, "DTE Property Test")
End Sub

.NET Framework Security

See Also

Reference

Process Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples