[Tutor] Watch and control access to an executable

Bill Burns billburns at pennswoods.net
Sat Apr 8 19:02:42 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.

OK. I understand a little better and will definitely look into this!!

The description of the recipe states:
"A script can use this code to determine whether another instance of 
itself is already in execution. 32-bit MSW only."

So I assumed it meant - you could use the recipe in your own scripts to
determine if the user was trying to start multiple instances of your 

My apologies to André!!!

Thanks for the explanation!


More information about the Tutor mailing list