Partager via


ToolWindows.GetToolWindow(String) Method

Definition

Allows the user to retrieve a window by its title.

public:
 System::Object ^ GetToolWindow(System::String ^ Name);
public:
 Platform::Object ^ GetToolWindow(Platform::String ^ Name);
winrt::Windows::Foundation::IInspectable GetToolWindow(std::wstring const & Name);
[System.Runtime.InteropServices.DispId(0)]
public object GetToolWindow (string Name);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member GetToolWindow : string -> obj
Public Function GetToolWindow (Name As String) As Object

Parameters

Name
String

The title of the window to retrieve.

Returns

A Window object.

Attributes

Examples

This example obtains the caption of the Output Window, after retrieving it using the GetToolWindow method.

Imports EnvDTE  
Imports EnvDTE80  
Sub GetToolWindow(ByVal dte As DTE2)  
    Dim win As OutputWindow  
    win = _applicationObject.ToolWindows.OutputWindow  
    Dim aStr As String = win.Parent.Caption  
    win = CType(_applicationObject.ToolWindows.GetToolWindow(aStr), _  
 OutputWindow)  
    MsgBox("The window caption, obtained via GetToolWindow method, _  
 is: " & vbCr & win.Parent.Caption)  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void GetToolWindow (DTE2 dte)  
{  
    Output win;  
    win = _applicationObject.ToolWindows.OutputWindow;  
    String aStr = win.Parent.Caption;  
    win =   
(OutputWindow)_applicationObject.ToolWindows.GetToolWindow(aStr);  
MessageBox.Show(("The window caption, obtained via GetToolWindow  
 method, is: " + "\n" + win.Parent.Caption);  
}  

Applies to