Try this :
using System.Diagnostics;
static void Main(string[] cmdLine )
{
Process[] myProcess = Process.GetProcessesByName("YourAppName");
if ( myProcess.Length > 1 )
{
MessageBox.Show( "The application is already launched...");
}
else
{
// Application Execution...
}
}
In article <6f****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
Hi,
Is there an easy way to limit a .NET application to a
single running instance, ala like checking the
hPrevInstance in MFC? October 2003 MSDN only has old
samples that use named mutexes; is there anything more
slick in .NET??
--Richard