static void Main(string[] args) { Application.EnableVisualStyles(); Application.ThreadException += new ThreadExceptionEventHandler(MyCommonExceptionHandlingMethod); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.SetCompatibleTextRenderingDefault(false); if (args.Length >= 1) { try { DummyForm f1 = new DummyForm(args[0]); Application.Run(f1); } catch { Application.Exit(); return; } } else { Application.Exit(); } }