by Will Barden (3 Submissions)
Category: Debugging and Error Handling
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (20 Votes)
Tired of your favourite VB program crashing because of General Protection Faults? Bad subclassing code? Well... if any unhandled exceptions occur, your program will be able to cope, and even continue running. Please leave a line or two to let me know if this has been useful. Thanks.
10/12/02 - Updated: Now the module top level exception handler will raise the error via Err.Raise to allow VB to handle the error using On Error statements. GPFs can now be caught, just the same as any other error :) Thanks to those below who suggested this.
Also, I added some more constants, to allow deriving of more information from the EXCEPTION_RECORD structure. This means more info for your user, which is always good.
Side Effects
Note that this won't catch normal VB errors, since these are handled by the VB runtime DLL. This will protect against General Protection Faults, which would ordinarily bring your application to it's knees.
Download GPF Exception Handler (23 KB)