销毁 Visual Studio 调试会话留下的无进程控制台窗口 [英] Destroy process-less console windows left by Visual Studio debug sessions

查看:24
本文介绍了销毁 Visual Studio 调试会话留下的无进程控制台窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows XP 安全更新 KB978037 的一个已知错误可能发生在 Visual Studio 2005(和 2008)中,有时如果您在控制台应用程序上重新启动调试会话,那么即使所有者处理没有,控制台窗口也不会关闭不再存在.此处进一步讨论了该问题:

A known bug with a Windows XP security update KB978037 can occur with Visual Studio 2005 (and 2008) where sometimes if you restart a debugging session on a console app then the console window doesn't get closed even though the owner process no longer exists. The problem is discussed further here:

Visual Studio 调试控制台有时保持打开状态,无法关闭

这些僵尸窗口无法通过任务栏或任务管理器关闭,通常需要关闭/打开电源才能摆脱它们.在一天的时间里,你可以积累很多,它们会堵塞你的任务栏,通常很烦人.

These zombie windows then can not be closed via the Taskbar or via the TaskManager, and typically require a power off/on to get rid of them. Over the period of even a single day you can accumulate quite a few of them, which clog up your TaskBar and are generally annoying.

我想我会敲出一个简单的 C++ Win32 实用程序,通过将 Windows 句柄作为 cmd 行参数传递并将其转换为 HWND 来尝试在这些窗口上调用 DestroyWindow().

I thought I would knock up a simple C++ Win32 utility to attempt to call DestroyWindow() on these windows by passing the windows handle as a cmd-line argument and converting it to a HWND.

我将句柄从字符串解析为 DWORD,然后将 DWORD 转换为 HWND.这似乎工作得好像我在它成功的句柄上调用 GetWindowInfo() 一样.然而,在句柄上调用 DestroyWindow() 失败并出现错误 5(访问被拒绝),大概是因为调用方进程(即我的应用程序)不拥有相关窗口.

I'm converting the handle from a string by parsing it as a DWORD then casting the DWORD to a HWND. This appears to be working as if I call GetWindowInfo() on the handle it succeeds. However calling DestroyWindow() on the handle fails with error 5 (access denied), presumably because the caller process (i.e. my app) doesn't own the window in question.

关于我如何摆脱僵尸窗口的任何想法,无论是通过上述方法还是其他任何不重新启动的替代方法?我在公司环境中,因此无法安装/卸载更新/服务包等.

Any ideas as to how I might get rid of the zombie windows, either via the above approach or any other alternative short of rebooting? I'm in a corporate environment so installing/uninstalling updates/service-packs etc isn't an option.

推荐答案

我知道这不是您想听到的,但摆脱这些窗口的唯一方法重新启动计算机

I know this is not what you want to hear but the only way to get rid of these windows is by rebooting the computer

显然 Windows 团队正在尝试修复它:

Apparently the windows team is trying to fix it:

http://blogs.msdn.com/debugger/archive/2010/03/11/help-my-console-windows-won-t-go-away.aspx

但似乎没有太多事情发生

but not much seems to be happening

这篇关于销毁 Visual Studio 调试会话留下的无进程控制台窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆