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?
A:
When you select Make Single Instance Application, starting a new copy of the program will automatically switch to the existing copy.
You can customize this behavior in the Application class.
SLaks
2010-01-20 00:29:17
A:
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.
No Refunds No Returns
2010-01-20 00:33:46