Quantcast
Channel: How to avoid multiple application instances? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

How to avoid multiple application instances?

$
0
0

I have an application, "myprogram.exe", which calls functions and code inside a dll, one of this functions that "myprogram.exe" calls create a new instance of a winform, "MyForm.cs" and then show it using form.show();.

I can have 'n' number of "myprogram.exe" instances running, but I want to have only one instance of "MyForm.cs" for each instance of "myprogram.exe".

The problem that I have is that even thought I'm using mutex inside "MyForm.cs" to create a mutex and them ask if an instance of it is already running, sometimes, it creates another instance, despite the mutex.

Is there another way that I can use to validate if an instance of "myprogram.exe" has already created an instance of "MyForm.cs".


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images