且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

识别C#或VB中的引发弹出窗口或消息框

更新时间:2023-02-08 15:46:43

您好,
我不知道您使用的是哪种类型的应用程序.因此,我已经在WPF和使用C#的窗口应用程序中进行了解释.

Hi,
I don''t know what type of application you are using. So I have explained in both WPF and window application using C#.

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);



当您在应用程序中未处理任何异常时,将调用此事件.

而下面的另一个事件将被称为天气,否则您将无法处理该异常



This event will get called when you have not handled any exception in you application.

and the below one more Event it will be get called weather or not you have handled the exception

AppDomain.CurrentDomain.FirstChanceException += new EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>(CurrentDomain_FirstChanceException);



希望这会有所帮助.



Hope this helps.