P
PL
I simply cannot get this to work with my current project, if I create a test
project
with only the code below it works fine but in my real app it still allows
two instances.
using System;
using System.Threading;
namespace MutexTest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Mutex appMutex = new Mutex(false, "Application");
if(appMutex.WaitOne(0, false))
{
System.Console.WriteLine("Running");
System.Console.ReadLine();
}
else
{
System.Console.WriteLine("App already running !");
}
}
}
}
The only difference between this test and my app is that I have more
code where I print the "Running" message, no other difference, still
it doesn't work !
I've read numerous other threads saying similar things but no solutions.
Could anyone shed some light as to why this does not work ?
Thank you
PL.
project
with only the code below it works fine but in my real app it still allows
two instances.
using System;
using System.Threading;
namespace MutexTest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Mutex appMutex = new Mutex(false, "Application");
if(appMutex.WaitOne(0, false))
{
System.Console.WriteLine("Running");
System.Console.ReadLine();
}
else
{
System.Console.WriteLine("App already running !");
}
}
}
}
The only difference between this test and my app is that I have more
code where I print the "Running" message, no other difference, still
it doesn't work !
I've read numerous other threads saying similar things but no solutions.
Could anyone shed some light as to why this does not work ?
Thank you
PL.