Is there a way to disable all the dialog boxes when an exception or error occurs(like access violations, indy socket errors, timeouts etc.)? They are thrown sometimes in my program, but these errors aren't fatal in any way and can be ignored, just the dialog boxes are disturbing. I use Delphi 7.
If you just don't wont to show the exception window then go to:
Tools/Options/Debugger Options/Language Exceptions and disable CheckBox Notify on language exceptions. That is walid for Delphi 2010.
(I don't remember if it is the same CheckBox in Delphi 7).
EDIT: In some cases the exceptions are unavoidable, specially when we are working with unknown files from internet. So, I believe that your exceptions are handled properly under Indy, just switch-off Notify on language exceptions
You can customize Application.OnException event. But IMVHO...
- Application.OnException suits best to log exceptions which you forgot to handle.
- Application.OnException should be used to catch exceptions only when you desperately need performance (in this case you should anticipate broken execution paths).
And:
- Access violations are fatal errors - you have to trace and get rid of all AV's.
- You can't hide exception dialogs just by Application.OnException override - you should use try finally/except in right way.
Bypass the Application.OnException event. However I would NOT recommend hiding every exception, IMHO that is poor design.
@ GJ - Delphi 2007 has that check box. But again as was mentioned above, access violation ain't the kind of exceptions that one should ignore.
来源:https://stackoverflow.com/questions/11020561/how-to-disable-all-exception-raising-in-delphi