I have a VB.NET program. In proerties/Application I checked Make a Single Instance Application. But it still allows someone from opening the program while already opened. How can I prevent this?
I have a VB.NET program. In proerties/Application I checked Make a Single Instance Application.
Share
The short answer is you can’t. VB does some tricks behind the scenes to help you accomplish this since it’s a common business requirement. However anything you create that is actually exclusive opens you to a denial of service attack by someone else maliciously creating/holding that resource and denying it to you.
Common ways are creating a well known mutex/semaphore/named pipe/something similar and if it already exists, exiting the instance just launched. There just isn’t a secure way of doing what you want to do.