Windows 中 Paint 事件中的异常和访问冲突 [英] Exceptions and Access Violations in Paint events in Windows

查看:29
本文介绍了Windows 中 Paint 事件中的异常和访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行一些新代码后,我的 C++ 应用程序开始出现奇怪的行为(屏幕更新不正确或不完整,有时根本没有屏幕更新).一段时间后,我们发现新代码导致了访问冲突.奇怪的是,该应用程序只是继续运行(但屏幕更新不正确).

After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all). After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates).

起初我们认为问题是由try-catch(...)"构造引起的(由一个过度活跃的前同事放在那里),但几个小时后(仔细检查调用堆栈,添加了许多断点,...)我们发现,如果绘制事件中存在访问冲突,Windows 会捕获它,然后继续运行应用程序.

At first we thought the problem was caused by a "try-catch(...)" construction (put there by an overactive ex-colleague), but several hours later (carefully inspecting the call stacks, adding many breakpoints, ...) we found out that if there's an Access Violation in a paint event, Windows catches it, and simply continues running the application.

  • 这是正常行为吗?
  • Windows 在绘制事件期间捕获异常/错误是否正常?
  • 有没有办法禁用它?(如果不是,则意味着我们必须始终在调试器中运行并在测试我们的代码时启用所有异常).

  • 在 XP 上正确崩溃(访问冲突后的预期行为)
  • 在 Vista 和 Windows 7 上,应用程序继续运行

推荐答案

这是一个已知缺陷.检查修补程序.http://support.microsoft.com/kb/976038

It's a known defect. Check the hotfix. http://support.microsoft.com/kb/976038

这篇关于Windows 中 Paint 事件中的异常和访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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