Jer*_*ell 5 c# vs-extensibility
我有一个 Visual Studio 集成包,可以跟踪调试窗口的输出。我可以获得输出窗口的 IVsTextView,如下所示:
IVsTextView view = GetService(typeof(SVsOutputWindow)) as IVsTextView;
// grab text from the view and process it
Run Code Online (Sandbox Code Playgroud)
但是,如果“调试”面板以外的其他面板当前处于活动状态,则此 IVsTextView 将包含来自该面板的文本,而不是“调试”面板。
是否可以为特定的输出窗口面板获取 IVsTextView,而无需在获取输出窗口的 IVsTextView 之前调用 OutputWindowPanel.Activate()?
当然,这是可能的。您只需选择要读取的输出窗口窗格:
IVsOutputWindow outWindow = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
// Give me the Debug pane
Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane;
IVsOutputWindowPane pane;
outWindow.GetPane(ref debugPaneGuid, out pane);
// Get text view and process it
IVsTextView view = pane as IVsTextView;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1033 次 |
| 最近记录: |