=====================================
使用全局事件扑捉
=====================================
using System;
using System.Windows.Forms;
//using Microsoft.Win32;
//注册全局的异常处理程序,扑获产生的异常。
namespace Zhengzuo.CSharpCode
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
if ( false == SingleInstance.HandleRunningInstance() )
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
//SystemEvents.SessionEnding += new SessionEndingEventHandler(SystemEvents_SessionEnding);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
1522

被折叠的 条评论
为什么被折叠?



