public static void SetErrorRestart() { //设置程序的异常处理 filter = new UnhandledExceptionFilter(MyUnhandledExceptionFilter); SetUnhandledExceptionFilter(filter); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); SetErrorMode(SEM_FAILCRITICALERRORS + SEM_NOOPENFILEERRORBOX + SEM_NOGPFAULTERRORBOX); }
private static extern Int32 SetUnhandledExceptionFilter(UnhandledExceptionFilter fun);
private static extern IntPtr SetUnhandledExceptionFilter(UnhandledExceptionFilter filter);