Export (0) Print
Expand All

ToolWindows Interface

Improves discoverability and usability of tool windows in the object model by providing easy access to the shell’s tool windows in their native types.

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

[GuidAttribute("19AC6F68-3019-4D65-8D98-404DFB96B8E2")]
public interface ToolWindows

The ToolWindows type exposes the following members.

  NameDescription
Public propertyCommandWindowGets the CommandWindow object.
Public propertyDTEGets the top-level extensibility object.
Public propertyErrorListGets the list of errors displayed in the IDE.
Public propertyOutputWindowGets the OutputWindow object.
Public propertySolutionExplorerGets a UIHierarchy object representing Solution Explorer.
Public propertyTaskListGets the TaskList object.
Public propertyToolBoxGets the ToolBox object.
Top

  NameDescription
Public methodGetToolWindowAllows the user to retrieve a window by its title.
Top

Visual Studio tool windows may be accessed through member properties. Other tool windows may be located with the GetToolWindow function.

This example adds an Output Window, titled "My output", activates it, and displays all the tool windows reached through the Collection object of the parent ToolWindows object. 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.

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;
    OutputToolWindow(_applicationObject);
}
public void OutputToolWindow(DTE2 dte)
{
    OutputWindow myOut;
    myOut = _applicationObject.ToolWindows.OutputWindow;
    OutputWindowPane myPane;
    String txt = null;
    MessageBox.Show("Creating an output window.");
    myPane = myOut.OutputWindowPanes.Add("My output");
    myPane.Activate();
    MessageBox.Show("Adding some text to the output window...");
    myPane.OutputString("This is the collection of tool
 windows,reached through the Output Window object:" + "\n");
    foreach (EnvDTE80.Window2 tempWindow in myOut.Parent.Collection)
    {
        txt = txt + (tempWindow.Caption + "\n");
    }
    MessageBox.Show("Displaying all the tool window captions 
in the output window...");
    myPane.OutputString(txt);
}

Community Additions

ADD
Show:
© 2014 Microsoft