Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close all tool windows in Visual Studio?

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!

like image 490
CubanX Avatar asked Dec 08 '10 14:12

CubanX


People also ask

How do I close all windows in Visual Studio?

If you want to close all but one open file, simply right-click on the tab and select Close All But This. This will close all open documents (floating included) except the tab you've right-clicked on.

How do I close a tab in Visual Studio?

Right-click on the current document's tab and select Close Tabs to the Left to close all tabs to the left.


2 Answers

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 :)

like image 125
CubanX Avatar answered Sep 18 '22 07:09

CubanX


You can assign a key to Window.AutoHideAll in vs2010 under Tools, Options Environment, Keyboard or use "Fullscreen" but these just hide the windows, not close them.

like image 23
Francis Shanahan Avatar answered Sep 20 '22 07:09

Francis Shanahan