To test this problem I have written a minimal windows application. If I force an access violation in the WM_PAINT handler this exception never gets to the debug
Starting from XP, the Vector Exception Handling functionality can be used. It has priority over all other kinds of exceptions. In my example, it correctly caught the Access Violation in the WM_PAINT message. Unfortunately, it also catches all other kinds of exceptions, which I should probably solve by checking for the exception code.