Is it possible to programmatically clear the Outpu

2020-04-02 18:09发布

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?

4条回答
淡お忘
2楼-- · 2020-04-02 18:24

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.

查看更多
啃猪蹄的小仙女
3楼-- · 2020-04-02 18:35

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)
查看更多
够拽才男人
4楼-- · 2020-04-02 18:42

Macro:

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

Simply assign a hotkey to this.

Edit: additional possibilities

查看更多
对你真心纯属浪费
5楼-- · 2020-04-02 18:42

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)
查看更多
登录 后发表回答