代码之家  ›  专栏  ›  技术社区  ›  Paolo Tedesco

visual studio 2008宏:写入到输出窗格

  •  13
  • Paolo Tedesco  · 技术社区  · 16 年前

    在Visual Studio宏中,如何在输出窗格(即通常包含生成输出的窗口)上写入执行信息?

    如果相关的话,我正在使用VisualStudio2008。

    解决方案 :我在我的宏项目中添加了以下子项,我将它们发布在这里,以防它们有用。

    Private Sub Write(ByVal name As String, ByVal message As String)
        Dim output As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
        Dim window As OutputWindow = output.Object
        Dim pane As OutputWindowPane = window.OutputWindowPanes.Item(name)
        pane.Activate()
        pane.OutputString(message)
        pane.OutputString(Environment.NewLine)
    End Sub
    
    Private Sub Log(ByVal message As String, ByVal ParamArray args() As Object)
        Write("Debug", String.Format(message, args))
    End Sub
    
    Private Sub Log(ByVal message As String)
        Write("Debug", message)
    End Sub
    
    1 回复  |  直到 16 年前
        1
  •  2
  •   Pete OHanlon    16 年前

    快速搜索显示 this