all groups > visual studio .net ide > september 2006 >
You're in the

visual studio .net ide

group:

Macro: OutputWindowPane.OutputString() is delayed


Macro: OutputWindowPane.OutputString() is delayed Boris
9/21/2006 10:28:56 PM
visual studio .net ide:
I want to output some data in OutputWindowPane while a rather lengthy macro
is running. The problem is that I don't see any output until the macro is
finished - then all the output appears at once.

When you click on the IDE of Visual Studio 2005 while the macro is running
you see a delay notification dialog. While this dialog is displayed output
appears in the OutputWindowPane one after another.

It seems like output is cached and you must force the IDE to display it.
Does anyone know how to do this?

Boris

Re: Macro: OutputWindowPane.OutputString() is delayed Oenone
9/27/2006 4:12:13 PM
[quoted text, click to view]

I'm afraid I can't (currently) help with the problem, but I am curious as to
how you're getting any output to appear at all.

I have a macro that runs on the OnBuildDone event, and I've tried everything
I can think of to get it to communicate with the user that initiated the
compilation. The only thing I've managed to do is display a MsgBox(), which
is much too intrusive for what I'm trying to do.

If you could let me see how you're getting text to the OutputWindowPane I'd
be most grateful. In return I'll see if I can find any way to get it to
display immediately.

TIA,

--

(O)enone

Re: Macro: OutputWindowPane.OutputString() is delayed Dirk
9/28/2006 3:03:50 AM
[quoted text, click to view]

I have the same problem as the original poster. The output is only visible
when the macro has finished. I hope there is something like Excel's
Application.ScreenUpdating. Here is how I display the output.

' Prepare output pane
With DTE.ToolWindows.OutputWindow.OutputWindowPanes
Try
' Get existing "Macros" pane
outputPane = .Item("Macros")
Catch ex As ArgumentException
' Does not exist yet, create new one
outputPane = .Add("Macros")
End Try
outputPane.Clear()
outputPane.Activate()
End With
' Make output window visible
DTE.ToolWindows.OutputWindow.Parent.Visible = True

' Then call this method during macro execution to display something
' Writes a single line including line feed to the output pane.
Private Sub OutputWriteLine(ByVal format As String, ByVal ParamArray args As
Object())
outputPane.OutputString(String.Format(format, args) & vbCrLf)
End Sub

Re: Macro: OutputWindowPane.OutputString() is delayed Boris
9/28/2006 3:32:15 AM
[quoted text, click to view]

Check out the Utilities module in the Samples project. There is a function
called GetOutputWindowPane. I copied this function to my own project and use
it like this:

Dim outputWindowPane As EnvDTE.OutputWindowPane
outputWindowPane = GetOutputWindowPane("My report")
outputWindowPane.OutputString("Test" + vbLf)

HTH,
Boris

AddThis Social Bookmark Button