static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Process currentProcess = Process.GetCurrentProcess();
Process[] processItems = Process.GetProcessesByName(currentProcess.ProcessName);
foreach (Process item in processItems)
{
if (item.Id != currentProcess.Id)
{
MessageBox.Show("Another instance running");
return;
}
}
Application.Run(new MForm());
}
Only 1 instance application run at a time
Không có nhận xét nào:
Đăng nhận xét