This documentation is archived and is not being maintained.

ToolWindows.GetToolWindow Method 

Allows the user to retrieve a window by its title.

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

Object GetToolWindow (
	string Name
Object GetToolWindow (
	String Name
function GetToolWindow (
	Name : String
) : Object



The title of the window to retrieve.

Return Value

A Window object.

This add-in obtains the caption of the Output Window, after retrieving it using the GetToolWindow method. For more information about how to run the automation examples, 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;
    GetToolWindow (_applicationObject);
public void GetToolWindow (DTE2 dte)
    Output win;
    win = _applicationObject.ToolWindows.OutputWindow;
    String aStr = win.Parent.Caption;
    win = 
MessageBox.Show(("The window caption, obtained via GetToolWindow
 method, is: " + "\n" + win.Parent.Caption);