static void Main(string[] args) { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Config.Init(); PathUtils.SetupFrameworkSDKPath(); Application.Run(new frmMain(args)); Config.Save(); } catch (ConfigurationException) { //ignore configuration save error } catch (Exception ex) { SimpleMessage.ShowException(ex); } }