[Tutor] Watch and control access to an executable
Alan Gauld
alan.gauld at freenet.co.uk
Sat Apr 8 18:44:48 CEST 2006
> If I'm not mistaken (and I certainly could be) I believe this recipe is
> used to control instances of an already running *script*. While I'm
> trying to control a completely different executable (program) written by
> someone else.
Nope, its si8mply creating an arbitrary Mutex, which is like a flag in
the OS itself. If the flag gets set OK - no errors - then you can go
ahead and launch your app, if theres an error the most likely reason
is that the app is already running.
Its exactly the same principle as using a blank file but tidier since
theres no file to delete(*) if things go wrong - although you might
need to reboot since I',m not sure how to delete a Mutex created
by another process, in fact I've only used a Mutex within a
single multi-threading app, but in principle theres no reason not
to use it this way too...
(*) Having the file has advantages since the administrator can
easily check with explorer to see if the app is in use, or manually
create one to block access to the app temporarily, but its a minimal
advantage I suspect.
Alan g.
More information about the Tutor
mailing list