Program 2번 실행 방지
Program 2번 실행 방지
Main Program에서 아래 굵은 부분을 추가
static System.Threading.Mutex singleton = new System.Threading.Mutex(true, "ssPLCADS");
[STAThread]
static void Main()
{
// Prevent launching my app multiple times
if (!singleton.WaitOne(TimeSpan.Zero, true))
{
//there is already another instance running!
MessageBox.Show("Instance already running");
Application.Exit();
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
** 출처 : https://stackoverflow.com/questions/93989/prevent-multiple-instances-of-a-given-app-in-net