Mutex...Really nice solution
I like your solution.
Originally posted by hspc
anyway this is my solution for this prolem :
How does it work ?
it creates a mutex (shared object that hace a uniqe name)..
if you try to recreate it you get the error :
this is the whole idea...
Another way (not this good, however)
is to have a check in sub main for a particular form
(FindWindow api will find it even if it is not visible)
you load and do not show. If you find it, program is
already running, if not, it is first instance
ie attached code
But your solution is better...
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.