Document.ActiveWindow Property
Gets the currently active window, or the topmost window if no others are active. Returns Nothing if no windows are open.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
ReadOnly Property ActiveWindow As Window
'Usage
Dim instance As Document
Dim value As Window
value = instance.ActiveWindow
Window ActiveWindow { get; }
property Window^ ActiveWindow {
Window^ get ();
}
function get ActiveWindow () : Window
Property Value
Type: EnvDTE.Window
A Window object.
Remarks
ActiveWindow returns the document's active window. You can set the caption only on Tool windows. If you attempt to set the caption on other window types, such as Document windows, you get the error, "Unspecified error."
Examples
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.