static void Main() { bool isNew; mutex = new Mutex(false, Application.ProductName + "_abcxyz16091994", out isNew); if (isNew) { //ok just this instance running Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); fmEinstellungen = new FormEinstellungen(); fmMain = new FormMain(); fmMain.IniFormMain(); Application.Run(); } else { MessageBox.Show("Eine Instanz des Programmes läuft bereits, bitte vorher beenden.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Information); //wait, we just want 1 instance running... run to end } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); fmEinstellungen = new FormEinstellungen(); fmMain = new FormMain(); fmMain.IniFormMain(); Application.Run(); }