Possible Duplicate:
What is the correct way to create a single instance application?
How to implement single instance per machine application?
I have a Winform-app which takes one parameter as an argument.
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Gauges(args));
}
}
This program is executed by another application several times a day.
Is it possible to check if my programm is already running and if so, can I use the running instance with the latest parameter?
You can use Mutex inside your application
Mutex is OS artifact, so, different instances of your application (executable) cann access the same object.
It depends how do you manage your app. You can use some
IPCmechanism to communicate requeired parameter to already running process.