My immediate reaction is that it sounds like a resource leak, and it crashes when you no longer have the type of resource you need.
[I deleted the rest of the previous answer because, based on Patrick's comments and a small investigation, this is clearly not applicable to the problem. ]
Following Patrick's comment, I quickly tested and duplicated the behavior in Windows 7. I started with a really minimal program (the base program created by VS 2008 for the Win32 project), and all I added was a non-existent address. Of course, you will not find any signs that something bad has happened.
Just for a laugh, I quickly checked how to respond to this exception. For what it stands, it does not resume after an exception, it just grabs it and skips the rest of the code in the WM_PAINT handler.
I am a little versed in MSDN, but so far I have not found any documentation that explains how and why this happened, whether it can be disabled, and if so, how, or much more. I have to agree: this is really a serious problem - if I caused an access violation (no, it cannot happen!) I want the program to work as quickly and quickly as possible. Disguising an error (especially one as serious as access violation) is an impressively bad idea!
source share