static void Main() { using (Mutex mutex = new Mutex(false, mutexKey)) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Application.EnableVisualStyles(); Application.ApplicationExit += OnApplicationExit; //SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; Application.SetCompatibleTextRenderingDefault(false); if (!mutex.WaitOne(0, false)) { return; } Directory.SetCurrentDirectory(Application.StartupPath); EncryptionCenter.Init(); StartupMgr.Instance.Start(); Application.Run(new frmMain()); } }