在delphi中运行时关闭delphi异常 [英] turn off delphi exceptions in run time in delphi

查看:215
本文介绍了在delphi中运行时关闭delphi异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Delphi应用程序中关闭在运行期间显示的异常消息?
i认为必须有一个指令来关闭异常消息,但我不能记住它。

解决方案

大多数异常消息可以通过处理 TApplication.OnException 事件。如果没有分配给该事件的处理程序,则应用程序对象仅显示异常消息。欢迎您致电 TApplication.ShowException 在你的处理程序中,如果你想要的某些例外。



该事件被触发为在VCL消息循环中运行时发生的异常。其他异常终止您的程序或当前线程。此外,事件仅针对从 Exception 下降的异常触发;来自其他类的异常将直接传递到 SysUtils.ShowException



无论您是否显示消息,一旦发生异常,您的程序仍然处于不确定状态,处理。消除这种消息的方式就像扫地毯下面的灰尘一样。更好的方法是使用例如日志记录工具,如 MadExcept EurekaLog ,或 JclDebug 记录关于异常的信息,并让您的客户选择将报告发送给您,以便您可以重现错误的条件并进行修复。


is there any way to turn off exception message showing during run-time in Delphi application? i think there must be a directive to turn off exception message but i cant remember it.

解决方案

Most exception messages can be suppressed by handling the TApplication.OnException event. The application object only displays an exception message if there isn't a handler assigned to that event. You're welcome to call TApplication.ShowException in your handler for certain exceptions if you want.

That event is fired for exceptions that occur while running in the VCL message loop. Exceptions that occur elsewhere terminate either your program or the current thread. Also, the event is fired only for exceptions that descend from Exception; exceptions that descend from other classes are passed directly to SysUtils.ShowException.

Whether you display a message or not, your program is still in an indeterminate state once an exception has occurred that you haven't handled. Merely suppressing the message is akin to sweeping the dust under the rug. A better course of action is to use an exception-logging tool like MadExcept, EurekaLog, or JclDebug that records information about the exception and gives your customers the option of sending the reports back to you so you can reproduce the conditions of the error and fix it.

这篇关于在delphi中运行时关闭delphi异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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