C# preventing more than one application instance at a time
//check if previous instance of the application is already running
//get the name of our process
string proc = Process.GetCurrentProcess().ProcessName;//Get the list of all processes by that name
Process[] processes = Process.GetProcessesByName(proc);//if there is more than one process
if (processes.Length > 1)
{
MessageBox.Show(”A previous instance of the application is already running”);
return;
}
