Re: How to allow a specific number of Instances of my app?



"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:GfKdnR6EFKZm69jYnZ2dnUVZ_sidnZ2d@xxxxxxxxxxxxxxx
I doubt that VB implements App.PrevInstance using a Mutex/Semaphore as it
is
so easily fooled. That's why the 'work-around', a Mutex, is often
suggested
as a more reliable mechanism.

The reason App.PrevInstance can be easily fooled is that the user can make a
copy of the EXE, rename it or put it into a different folder and run the EXE
twice. Under the hood, VB6 uses the current EXE fully qualified path as a
mutex/semaphore, so if the user renamed the EXE, a different mutex/semaphore
is created. In this case, App.PrevInstance is fooled, so the solution is to
make a mutex that is not dependant on the file name.

One must also use the "Global\" prefix in certain OS'es(after checking the
version number) to prevent the user from running a second copy of the app in
another terminal server session, or a second session in XP fast user
switching. I think if not specified, it's considered local to the session by
default.



.



Relevant Pages

  • Re: Synchronised Read/Write Problem
    ... A mutex will help you if you had a true Singleton object. ... Sam Santiago ... >> access to this external EXE behave in a single threaded manner. ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Mutex not working as expected
    ... Are you sure that the mutex isn't getting GC'd? ... I get the impression it is true on server side for server ... User session), The admin session. ... >> Sub Main ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Running processes
    ... a win32 console application is already runing or not from another win32 ... console application.I need only one copy of exe has to run(for that i ... the return value is a handle to the mutex object. ... If the function fails, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Checking for another instance of an application
    ... start the same exe twice from the exact same location. ... Start the app using the mapped path ... your app and using that to name the mutex is a good idea. ... > Gary Novosel ...
    (microsoft.public.vb.general.discussion)
  • Re: [Info-Ingres] Mutex: DCB iidbdb
    ... What does the logstat show for that session? ... Subject: Mutex: DCB iidbdb ... Enterprise Linux Server release 5. ...
    (comp.databases.ingres)