Close all tool windows in Visual Studio?

visual-studio, visual-studio-2010

Solution

Ok, thanks to this blog I was able to cobble together a working solution. I'll recap it here in case that link ever dies, but all credit goes to The Boolean Frog (aka Pascal).

Create a macro in Visual Studio 2010 (Under Tools -> Macros -> Macros IDE...) and put this code inside a public module:

Public Sub CloseAllToolWindows()
    Dim items As EnvDTE.Windows = DTE.Windows
    Dim item As Window

    For Each item In items
        If item.Kind.Equals("Tool") And item.Visible Then
            item.Close()
        End If
    Next
End Sub

Then head to Tools -> Options -> Enivornment -> Keyboard, inside the dialog there, under the Show commands containing: box, search for Macros. Your newly created macro is right there, assign it a keyboard shortcut, and Bob's your uncle you can close all Tool Windows :)

I personally used the code Ctrl-W, C for, umm, "Window, Close" but you can use whatever you'd like :)

Problem

I've started to pull out my tool windows in VS2010. I like the way it works, I put tool windows on one monitor, and my code on the other. However, my only gripe is occasionally I want to quickly close all the tool windows, and I'd love a way to close them all in one fell swoop. I know about Shift-Esc to close an individual window, but is there a way to close ALL tool windows at once? A VS2010 specific answer is fine, but anything that would work would be swell. Thanks!

Original source