clear output window with EnvDTE80 OK - how about EnvDTE90? VS9

R

Rich P

The following code sample will clear the output window (Debug window)
programmatically in VS2008 (note: requires a reference to both EnvDTE,
and to EnvDTE80)

private void ClearOutput()
{
EnvDTE80.DTE2 ide =
(EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("V
isualStudio.DTE.9.0");
ide.ExecuteCommand("Edit.ClearOutputWindow","");
System.Runtime.InteropServices.Marshal.ReleaseComObject(ide);
}

If I need to write something to the console (output) window for
debugging/testing from a winform app I can call my ClearOutput() routine
to clear out startup output or previous output. But for the sake of
understanding, I made an additional reference to EnvDTE90 to try
clearing the output window. EnvDTE90 does not have DTE2, instead has
Debugger3.

EnvDTE90.Debugger3 ide =
(EnvDTE90.Debugger3)System.Runtime.InteropServices.Marshal.GetActiveObje
ct("VisualSudio.DTE.9.0");

//error out here -- EnvDTE90.Debugger3 no ExecuteCommand
ide.ExecuteCommand("Edit.ClearOutputWindow","");

Anyone know how to use EnvDTE90 to clear the output window the same as
EnvDTE80 above?

Thanks,

Rich
 
P

Pete Nolastname

With my VS 2008 I had to use the line:
.... GetActiveObject("VisualStudio.DTE.9.0");

So MAYBE using:
.... GetActiveObject("VisualStudio.DTE.10.0");
would work.

I'm interested if that does it for you.

Thanks,

Pete

P.S. I'm really inexperienced in this area of VS, so don't freak out if it doesn't work! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top