private static void Main() { try { // 注册全局线程异常处理事件侦听 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Process instance = Start.RunningInstance(); if (instance == null) { yoyoConst.Initproject(true); LogisTrac.WriteLog("程序启动"); string mainversion = OperateIniFile.ReadIniData_main("MAIN_VERSION"); string res = OperateIniFile.ReadVersionIniData("RES_VERSION"); LogisTrac.WriteLog("kangjia版本V" + mainversion); LogisTrac.WriteLog("res版本V" + res); LogisTrac.WriteLog("StartupPath" + Application.StartupPath); LogisTrac.WriteLog("GetCurrentDirectory" + System.IO.Directory.GetCurrentDirectory()); // Application.Run(new indexform()); Application.Run(new indexForm2());//indexForm2 KillProcess("kangjiamain"); return; } Start.HandleRunningInstance(instance); } catch (Exception ex) { Application.Run(new indexForm2()); LogisTrac.WriteLog(ex.Message); } }