- added check to not allow more than one instance of the program to run at any one time
This commit is contained in:
parent
3fdc1fdb00
commit
f1d4febf8f
1 changed files with 12 additions and 4 deletions
|
@ -524,11 +524,19 @@ namespace BetterJoyForCemu {
|
|||
mgr.OnApplicationQuit();
|
||||
}
|
||||
|
||||
private static string appGuid = "04450797-3520-462e-a563-107677a483d8"; // randomly-generated
|
||||
static void Main(string[] args) {
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
form = new MainForm();
|
||||
Application.Run(form);
|
||||
using (Mutex mutex = new Mutex(false, "Global\\" + appGuid)) {
|
||||
if (!mutex.WaitOne(0, false)) {
|
||||
MessageBox.Show("Instance already running.", "BetterJoy");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
form = new MainForm();
|
||||
Application.Run(form);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue