12

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
  • 37,241
  • 25
  • 195
  • 267
Drake
  • 8,225
  • 15
  • 71
  • 104
  • @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

8

Macro:

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

Simply assign a hotkey to this.

Edit: additional possibilities

Community
  • 1
  • 1
mafu
  • 31,798
  • 42
  • 154
  • 247
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
  • 6,167
  • 4
  • 34
  • 47
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
  • 860
  • 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
  • 8,268
  • 8
  • 31
  • 54