using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading; using System.Windows.Forms; namespace SOH.JianYan.DEC_CS800B { #region class SingleInstance static class SingleInstance { private static Mutex mutex = null; public static bool CreateMutex() { return CreateMutex(Assembly.GetEntryAssembly().FullName); } public static bool CreateMutex(string name) { bool result = false; mutex = new Mutex(true, name, out result); return result; } public static void ReleaseMutex() { if (mutex != null) { mutex.Close(); } } } #endregion static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { string key = Application.StartupPath + "\\SOH.OnLine.exe"; key = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(key, "MD5"); if (!SingleInstance.CreateMutex()) return; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new CS800B()); } } }