Visual Studio Developer Center > Microsoft Visual Studio 2010 Beta 2 Forums > Visual Studio Extensibility Beta 2 > Add-In: DTE2.Windows collection doesn't contain all windows?
Ask a questionAsk a question
 

AnswerAdd-In: DTE2.Windows collection doesn't contain all windows?

  • Friday, November 06, 2009 8:39 AMPhlow2001 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'm writing an add-in in Visual Studio 2010 Beta 2, C#, .NET 4.0.  I am trying to hide all but a few windows in the IDE, in a specific situation.  I have created a new WindowConfiguration, and Apply()'d it, and I'm then trying to enumerate all the windows and .Close() them.

    I have tried enumerating using the DTE2.Windows collection, as well as the IEnumWindowFrames method, but there only seems to ever be these windows by default: Start Page, Solution Explorer, Class View, Object Browser, Find and Replace.

    The Server Explorer is part of a tab that is hidden by default.  If I activate that tab, then the Server Explorer is included in the Windows collection.  It seems VS is loading windows on demand, which is nice, but it leaves me with a problem.  I want to be able to hide the tabs that represent windows, whether the window has been loaded or not.

    Is there a way to enumerate all the windows in the IDE that are either visible or may be hiding with a tab , or is there a way to access the tabs and hide them?

    Thanks

Answers

  • Monday, November 09, 2009 10:44 PMChris McGuire Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No you can't do this through DTE.    DTE will only enumerate the tools that have been loaded.    Delay loaded components will not appear in the list.   I assume that you are doing this in a macro.     If you are able to use Dev10 interfaces you can use IVsUIShell4.GetWindowEnum( WINDOWFRAMETYPE_Tool | WINDOWFRAMETYPE_AllStates, ...) to enumerate all tools even those that have not yet been created.
    • Marked As Answer byPhlow2001 Tuesday, November 10, 2009 1:00 PM
    •  

All Replies

  • Monday, November 09, 2009 10:44 PMChris McGuire Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No you can't do this through DTE.    DTE will only enumerate the tools that have been loaded.    Delay loaded components will not appear in the list.   I assume that you are doing this in a macro.     If you are able to use Dev10 interfaces you can use IVsUIShell4.GetWindowEnum( WINDOWFRAMETYPE_Tool | WINDOWFRAMETYPE_AllStates, ...) to enumerate all tools even those that have not yet been created.
    • Marked As Answer byPhlow2001 Tuesday, November 10, 2009 1:00 PM
    •  
  • Monday, November 09, 2009 10:54 PMPhlow2001 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Not a macro, this is an add-in.  IVsUIShell4.GetWindowEnum looks like it may be what I'm looking for.  Will check it out and report back.  Thanks
  • Tuesday, November 10, 2009 1:04 PMPhlow2001 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    That was what I was looking for.  I was able to remove the tabs for tool windows I didn't want and show the ones I wanted.  I did have to Show() prior to setting the FrameMode to Dock though, for some reason.