再Program.cs中先using System.Diagnostics;
再寫入程式碼
string processName = Process.GetCurrentProcess().ProcessName;
Process[] p = Process.GetProcessesByName(processName);
if (p.Length > 1)
{
MessageBox.Show("已有同樣程式使用中");
Environment.Exit(1);
}
沒有留言:
張貼留言