WindowVisibilityEvents Interface
Tells whether ToolWindows are visible (hide or show). Use this object for functionality and refer to WindowVisibilityEventsClass for this object's documentation.
Assembly: EnvDTE80 (in EnvDTE80.dll)
| Name | Description | |
|---|---|---|
![]() | add_WindowHiding(_dispWindowVisibilityEvents_WindowHidingEventHandler) | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
![]() | add_WindowShowing(_dispWindowVisibilityEvents_WindowShowingEventHandler) | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
![]() | remove_WindowHiding(_dispWindowVisibilityEvents_WindowHidingEventHandler) | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
![]() | remove_WindowShowing(_dispWindowVisibilityEvents_WindowShowingEventHandler) | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
| Name | Description | |
|---|---|---|
![]() | WindowHiding | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
![]() | WindowShowing | This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.(Inherited from _dispWindowVisibilityEvents_Event.) |
Run this example and open and close the Command Window and the Output Window in the Visual Studio IDE to see event capturing methods in action.
namespace CS_Events_Code { using System; using Microsoft.VisualStudio.CommandBars; using Extensibility; using EnvDTE; using EnvDTE80; using System.Windows.Forms; public class Connect : Object, IDTExtensibility2 { public Connect() { } public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { applicationObject = (DTE2)application; addInInstance = (AddIn)addInInst; EnvDTE80.Events2 events = (EnvDTE80.Events2 )applicationObject.Events; windowsVisEvents = (EnvDTE80.WindowVisibilityEvents)events.get_WindowVisibilityEvents (null); // Connect to each delegate exposed from the windows visibiliy // events object retrieved above windowsVisEvents.WindowHiding +=new _dispWindowVisibilityEvents_WindowHidingEventHandler (this.WindowHiding); windowsVisEvents.WindowShowing +=new _dispWindowVisibilityEvents_WindowShowingEventHandler (this.WindowShowing); } public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom) { if (windowsVisEvents != null) { windowsVisEvents.WindowHiding -= new _dispWindowVisibilityEvents_WindowHidingEventHandler (this.WindowHiding); windowsVisEvents.WindowShowing -= new _dispWindowVisibilityEvents_WindowShowingEventHandler (this.WindowShowing); } } public void OnAddInsUpdate(ref Array custom) { } public void OnStartupComplete(ref Array custom) { } public void OnBeginShutdown(ref Array custom) { } private DTE2 applicationObject; private AddIn addInInstance; private EnvDTE80.WindowVisibilityEvents windowsVisEvents; public void WindowHiding(EnvDTE.Window winRef) { MessageBox.Show("The window " + winRef.Caption + " is hiding."); } public void WindowShowing(EnvDTE.Window winRef) { MessageBox.Show("The window " + winRef.Caption + " is showing."); } } }

