Program.cs
//Program.cs
public static Queue<string> Messages = new Queue<string>();
static string appGuid = "{af80bd69-73bc-4148-9377-87b6ab52bed5}";//自行設定的GUID
[STAThread]
static void Main()
{
using(Mutex m = new Mutex(false, "Global\\" + appGuid))
{
if(!m.WaitOne(0, false))
{
MessageBox.Show("Program is running!");
return;
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}