Hi,
Is there a way to programatically clear the Output window of the IDE? Tried searching for it on the Internet but to no avail.
Thanks.
BTW, I'm still in VS.Net 2003.
Printable View
Hi,
Is there a way to programatically clear the Output window of the IDE? Tried searching for it on the Internet but to no avail.
Thanks.
BTW, I'm still in VS.Net 2003.
You would have to use the EnvDTE classes and namespace, by adding a reference to it. This is an addin that lets you control the IDE objects (I believe). Searched around and found a link below of an example of using it to get a handle on the output window, and once you do that, there is an OutPutWindow.ActivePane.Clear() method that you can run in order to clear it...
http://www.codeproject.com/macro/VSReadFileOutWin.asp
Thanks gigemboy, seems it might solve my problem. So far I've tried this (but no success as yet)It runs fine but doesn't clear out the Output window. Seems to be a minor flaw. Will see it later (need to get onto another task for now.)VB Code:
Dim dte As EnvDTE.DTE dte = System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE") Dim mwin As Window = dte.Windows.Item(EnvDTE.Constants.vsext_wk_OutputWindow) ' .vsWindowKindOutput) Dim ow As OutputWindow = mwin.Object Dim tmp As OutputWindowPane For Each tmp In ow.OutputWindowPanes tmp.Clear() Next
I worked with it a little and was able to do it. The GetActiveObject call needs to change due to you using 2003, and I think that code was for the original 2002. You just need to change the object to "VisualStudio.DTE.7.1", and it should work, with just calling the .ActivePane.Clear method of the "ow" outputwindow object, like below:
It was tested in 2003, and cleared the output window fine...VB Code:
'***Note - this code requires option strict to be off, otherwise you will have to cast the objects Dim dte As EnvDTE.DTE 'below uses the 7.1 DTE for 2003 dte = System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1") Dim mwin As Window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput) Dim ow As OutputWindow = mwin.Object ow.ActivePane.Clear()
This code can be used in 2005 by changing the DTE to "VisualStudio.DTE.8.0"
Thanks gigemboy, that solved it. And the loop was one of the trials after the initial ow.ActivePane.Clear() was not working. Thanks again. :thumb: