10

Do you know a way to add some code that, during debug, programmatically clear the Output Window in Visual Studio?

Or do you know some fast alternative like a key shortcut?

Cœur
  • 34,719
  • 24
  • 185
  • 251
Drake
  • 8,108
  • 15
  • 68
  • 102
  • @mafutrct could be an idea, but I never done it, I have to investigate – Drake Apr 16 '10 at 09:17
  • possible duplicate of [Can the Visual Studio (debug) Output window be programatically cleared?](http://stackoverflow.com/questions/2391473/can-the-visual-studio-debug-output-window-be-programatically-cleared) – nawfal Jul 02 '14 at 22:03

4 Answers4

7

Macro:

Sub ClearOutputWindow()
    DTE.ExecuteCommand("Edit.ClearOutputWindow")
End Sub

Simply assign a hotkey to this.

Edit: additional possibilities

Community
  • 1
  • 1
mafu
  • 30,246
  • 38
  • 143
  • 244
1

To clear the IMMEDIATE window in VS2010

    Dim dte = Marshal.GetActiveObject("VisualStudio.DTE.10.0")
    Dim ide As EnvDTE80.DTE2 = dte
    Dim currentActiveWindow = dte.ActiveWindow
    dte.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}").Activate() 'Activate Immediate Window  
    dte.ExecuteCommand("Edit.SelectAll")
    dte.ExecuteCommand("Edit.ClearAll")
    currentActiveWindow.Activate()

    Marshal.ReleaseComObject(dte)
smirkingman
  • 5,971
  • 2
  • 33
  • 46
0

the output window feature is documented here, some guys are talking about how to access the output window here, so i think you can clear it progamatically.

Hassen
  • 825
  • 2
  • 11
  • 23
  • the first shows some example how to interact with the output window, but I think I need to create a plugin myself to do it; the second link is based on CodeRush, I will look into it. In the meanwhile if you know a simpler way... – Drake Apr 16 '10 at 09:22
0

I have changed unreadable "{ECB7191A-597B-41F5-9843-03A4CF275DDE}" guid code from smirkingman's answer to "Immediate Window" and it worked as well (also removed unnecessary codes for my own):

Dim dte As EnvDTE80.DTE2 = Marshal.GetActiveObject("VisualStudio.DTE.11.0")
dte.Windows.Item("Immediate Window").Activate() 'Activate Immediate Window  
dte.ExecuteCommand("Edit.SelectAll")
dte.ExecuteCommand("Edit.ClearAll")
Marshal.ReleaseComObject(dte)
Mojtaba Rezaeian
  • 7,315
  • 7
  • 27
  • 50