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
[EMAIL PROTECTED]
_______________________________________________
use-revolution mailing list
[email protected]
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
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution