次の方法で共有


Document.ActiveWindow プロパティ

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

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

構文

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

プロパティ値

型 : EnvDTE.Window
Window オブジェクト。

解説

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

public void WindowExample(DTE2 dte)
{  // Before running, create a text file named 
   // "TextFile1.txt", include it in your solution,
   // and select some text.
   Window win;
   Document doc;
   if (dte.Documents.Count > 0)
   {
      doc = dte.Documents.Item("TextFile1.txt");
      win = doc.ActiveWindow;
      // Show the name of the project that contains this window and document.
      MessageBox.Show(win.Project.Name);
   }
}

.NET Framework セキュリティ

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

参照

関連項目

Document インターフェイス

EnvDTE 名前空間