static void Main()
{
// 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("Application is already running");
return;
} else
Application.Run(new Form1());
}
{
// 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("Application is already running");
return;
} else
Application.Run(new Form1());
}