_DTE.ActiveWindow プロパティ

更新 : 2007 年 11 月

現在アクティブなウィンドウ、または他にアクティブなウィンドウがない場合は最前面に表示されたウィンドウを返します。

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

構文

'宣言
ReadOnly Property ActiveWindow As Window
'使用
Dim instance As _DTE
Dim value As Window

value = instance.ActiveWindow
Window ActiveWindow { get; }
property Window^ ActiveWindow {
    Window^ get ();
}
function get ActiveWindow () : Window

プロパティ値

型 : EnvDTE.Window

Window オブジェクト。開いているウィンドウがない場合は、Nothing を返します。

解説

ActiveWindow は、環境のアクティブ ウィンドウを返します。

キャプションを設定できるのはツール ウィンドウだけです。ドキュメント ウィンドウなど、他の種類のウィンドウにキャプションを設定しようとすると、"予期しないエラーです" というエラーが表示されます。

Sub ActiveWindowExample(ByVal dte As DTE2)

    ' Create two text files.
    Dim doc1 As Document = _
        dte.ItemOperations.NewFile(, "Document1").Document
    dte.ItemOperations.NewFile(, "Document2")

    MsgBox("The active window is " & dte.ActiveWindow.Caption)

    If MsgBox("Activate Document1?", MsgBoxStyle.YesNo) = _
        MsgBoxResult.Yes Then
        doc1.Activate()
    End If

    MsgBox("The active window is " & dte.ActiveWindow.Caption)

End Sub
public void ActiveWindowExample(DTE2 dte)
{
    // Create two text files.
    Document doc1 = dte.ItemOperations.NewFile(@"General\Text File", 
        "Document1", Constants.vsViewKindPrimary).Document;
    dte.ItemOperations.NewFile(@"General\Text File", "Document2", 
        Constants.vsViewKindPrimary);

    MessageBox.Show("The active window is " + 
        dte.ActiveWindow.Caption);

    if (MessageBox.Show("Activate Document1?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
        doc1.Activate();

    MessageBox.Show("The active window is " + 
        dte.ActiveWindow.Caption);
}

アクセス許可

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

参照

参照

_DTE インターフェイス

_DTE メンバ

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する