multiple instances of standalone under Windows

Dar Scott dsc at swcp.com
Thu Jan 29 16:19:13 EST 2004


On Thursday, January 29, 2004, at 01:45 PM, Chris Sheffield wrote:

> Does anyone have a way to check if another instance of a standalone is
> already running, and if so close the one that was just opened?

Try 'accept' on some obscure port.  If it fails, assume that another 
app is running.  (Immediately close any connections in the call back, 
should any be made.)  I'd try UDP first.  If you need to listen to a 
port anyway, you are set.

You could try creating and deleting a folder.  This will work faster 
than a file, I think.  If you need some temp files, anyway, put this 
where you put your temp files and put your temp files in there.  You 
may need to work out the rare case of two programs trying to run at the 
same time.

There is probably some shell command you can use.  That may work well, 
since you only need one platform.  This also needs to address the 
problems of two starting at the same time.

If you feel comfortable with two not starting at the same time, then 
you don't have to worry about that.

The openProcesses() function applies to processes opened with 'open 
process'.

Dar Scott

****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list