External for running one instance on windows

Lynch, Jonathan bnz2 at cdc.gov
Mon Jul 18 12:20:51 EDT 2005


This external is prolly a bit easier to use than the old way, but...

There is a cross platform method for doing this, which has been
discussed on this group. It has the convenience of checking to make sure
that the first version is running, then if the first instance
communicates back to the second instance that it is running, the second
instance will shut down. It involves the use of ports, which can be a
pain to use.

Just FYI

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Chris
Sheffield
Sent: Monday, July 18, 2005 12:16 PM
To: How to use Revolution
Subject: Re: External for running one instance on windows

Hi Trevor,

This is great.  I've been looking for a good solution to this problem  
for quite some time.  I've been using a partial solution with the  
EXT.dll, but it doesn't always work.

One question:  Will this work on any version of Windows, or is it  
specific to, say, 2000/XP?

Chris


On Jul 16, 2005, at 4:14 PM, Trevor DeVore wrote:

> Hi people of the list,
>
> I put together an external this morning that you can use to limit  
> your application to one running instance on Windows.  It uses a  
> mutex object on Windows which you can read about here:
>
> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ 
> dllproc/base/using_mutex_objects.asp>
>
> There is a readme with the archive but basically there are two  
> handlers you use:
>
> get ewinRegisterApp("My_App_Unique_String")
> ewinUnregisterApp
>
> You can ewinRegisterApp("My_App_Unique_String") when your app first  
> launches.  If it returns true then there is only one instance of  
> your app running.  If it returns false then another app has  
> registered the same string (in this case "My_App_Unique_String")  
> and you should quit.
>
> When you quit your app you call ewinUnregisterApp to release the  
> mutex object you created with ewinRegisterApp().
>
> Now you may be asking yourself what would happen if your app  
> crashes.  Would ewinRegisterApp() still return false?  The answer  
> is no, it would return true.  Windows knows that the app that  
> created the original mutex object has gone the way of all  
> misbehaved software and it will gladly give you control of the  
> orphaned mutex object.
>
> Anyway, I've tested this on Win XP so far and it seems to be  
> working nicely.  Note that for every time you call ewinRegisterApp 
> () in one app you need to call ewinUnregisterApp in order for  
> another app to be able to have ewinRegisterApp() return true.  I  
> may fix that, I may not.  It doesn't really bother me.
>
> Anyway, you can download it at:
>
> <http://www.mangomultimedia.com/download/revolution/enhancedwin/ 
> EnhancedWin.zip>
>
> There is also a command called ewinOpenURL in the external that  
> will always do the right thing when trying to open a url or launch  
> an email client on Windows.  You may find that useful as well.
>
> If you have any questions or problems let me know.  If you want the  
> source code you can have that too.  It was compiled with Visual C+ 
> + .Net.
>
> -- 
> Trevor DeVore
> Blue Mango Multimedia
> trevor at mangomultimedia.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

------------------------------------------
Chris Sheffield
Read Naturally
The Fluency Company
http://www.readnaturally.com
------------------------------------------


_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list