Allow only one instance of console application to run

H

Hardy Wang

How to allow only one instance of console application to run on one single
machine?

Thanks!
 
C

Chris Springer

Well, you could create your own class inherited from the Console class and
add a static field that would keep track of how many instances of your class
there are. You can then check this field in your code to only open a new
console session if there are no other sessions open. This is just a thought
and there might be another more efficient way to do it...anyone?!

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
 
T

TerryFei

Hi ,
I just wanted to check how things are going and whether or not your issue
has been resolved.
If there is any question, please feel free to join the community and we are
here to support you at your convenience. Thanks again and have a nice day.

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top