Compartir a través de


Window2.Object Property

Gets an object that can be accessed by name at run time.

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

Syntax

'Declaration
ReadOnly Property Object As Object
Object Object { get; }
property Object^ Object {
    Object^ get ();
}
abstract Object : Object with get
function get Object () : Object

Property Value

Type: Object
An object.

Remarks

Returns the extensibility object for the tool represented by the window.

Examples

This example creates an OutputWindow object, and then uses it to write text to an OutputWindowPane 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.

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)
    ObjectExample(_applicationObject)
End Sub
Sub ObjectExample(ByVal dte As DTE2)
    Dim win As Window2
    win = _
CType(_applicationObject.Windows.Item _
(Constants.vsWindowKindOutput), Window2)
    Dim output As OutputWindow
    Dim outpane As OutputWindowPane
    output = CType(win.Object(), OutputWindow)
    outpane = output.OutputWindowPanes.Add("my output")
    outpane.OutputString("Add test text to an Ouput  _
    pane obtained from the Window2.Object.")
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;
    ObjectExample(_applicationObject);
}
public void ObjectExample (DTE2 dte)
{
    Window2 win;
    win = 
(Window2)_applicationObject.Windows.Item
(Constants.vsWindowKindOutput);
    OutputWindow output;
    OutputWindowPane outpane;
    output = (OutputWindow)win.Object;
    outpane = output.OutputWindowPanes.Add("My Output");
    outpane.OutputString("Add test text to an Ouput pane 
obtained from the Window2.Object.");
}

.NET Framework Security

See Also

Reference

Window2 Interface

EnvDTE80 Namespace