DTE Property

EditPoint.DTE Property

 

Gets the top-level extensibility object.

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

DTE DTE { get; }

Property Value

Type: EnvDTE.DTE

A DTE object.

Implements

TextPoint.DTE

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

public void DTEExample(DTE2 dte)
{
    string msg = "The current Output Window object belongs to the ";
    OutputWindow output = dte.ToolWindows.OutputWindow;

    if (IsMacrosIDE(output.DTE))
        MessageBox.Show(msg + "macros IDE.");
    else
        MessageBox.Show(msg + "main IDE.");

    output = ((DTE2)dte.MacrosIDE).ToolWindows.OutputWindow;

    if (IsMacrosIDE(output.DTE))
        MessageBox.Show(msg + "macros IDE.");
    else
        MessageBox.Show(msg + "main IDE.");
}

bool IsMacrosIDE(DTE ide)
{
    bool val = true;

    try
    {
        // The MacrosIDE property throws an exception if ide 
        // is not the main DTE object.
        if (ide.MacrosIDE != null)
            val = false;
    }
    catch (Exception ex)
    {
    }

    return val;
}
Return to top
Show:
© 2016 Microsoft