Window2.Object プロパティ

実行時に名前でアクセスできるオブジェクトを取得します。

名前空間:  EnvDTE80
アセンブリ:  EnvDTE80 (EnvDTE80.dll 内)

構文

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

プロパティ値

型 : Object
オブジェクト。

解説

ウィンドウで指定されたツールの extensibility オブジェクトを返します。

この例では、OutputWindow オブジェクトを作成し、そのオブジェクトを使用して OutputWindowPane オブジェクトにテキストを書き込みます。

このアドインの例を実行する方法の詳細については、「方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する」を参照してください。

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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Window2 インターフェイス

EnvDTE80 名前空間