Compartir a través de


Windows2.DTE Property

Gets the top-level extensibility object.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.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 call "Application".

Examples

This example accesses the DTE object through a Windows2 object to display the name of the IDE.

For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ReachDTE(_applicationObject)
End Sub
Sub ReachDTE(ByVal dte As DTE2)
    Dim win As Windows2
    win = CType(_applicationObject.Windows, EnvDTE80.Windows2)
    MsgBox("The DTE name, reached through the Window2 object, is: " _
 & vbCr & win.DTE.Name)
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ReachDTE(_applicationObject);
}
public void ReachDTE(DTE2 dte)
{
    Windows2 win;
    win = (EnvDTE80.Windows2)_applicationObject.Windows;
    MessageBox.Show("The DTE name, reached through the Window2 object,
 is: " + "\n" + win.DTE.Name);
}

.NET Framework Security

See Also

Reference

Windows2 Interface

EnvDTE80 Namespace

Other Resources

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