c# - 使用 DTE 激活 Visual Studio 的输出窗口

标签 c# visual-studio envdte vspackage

我为我的 VSPackage 创建了一个自定义输出窗口 Pane :

Output window and tabs in Visual Studio 2013

使用此代码:

// Creating Output Window for our package.
IVsOutputWindow output = GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
Guid guildGeneral = Microsoft.VisualStudio.VSConstants.OutputWindowPaneGuid.GeneralPane_guid;
int hr = output.CreatePane(guildGeneral, "Codex", 1, 0);
hr = output.GetPane(guildGeneral, out ApplicationConstants.pane);

ApplicationConstants.pane.Activate();

问题

当前选择其他选项卡时,如何选择“输出”选项卡?

最佳答案

在 Visual Studio 的输出窗口上激活(聚焦):

DTE dte = (DTE)GetService(typeof(DTE));
Window window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
window.Activate();

关于c# - 使用 DTE 激活 Visual Studio 的输出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31125153/

相关文章:

c# - 如何复制一个对象,然后将其与原始对象进行比较,看是否发生了变化?

c# - TreeView 闪烁?

.net - 从现有 .Net 项目自动创建 UML 图的免费工具

visual-studio - 使用 Gulp 更新 ASP.NET CORE 2 中的 Bootstrap + SASS?

c# - 使用 EnvDTE 收集项目中的用户类列表

c# - 有没有办法使用 ENVDTE 选择项目?

c# - 移动虚线进行裁剪

c# - 从数据 GridView 中读取数据

.net - 如何为自定义异常类型关闭 "Break when exception is thrown"

powershell - 在管道变量上“必须指定一个对象”到 Get-Member