On 11-Sep-06, at 6:19 AM, Dr Gerard Hammond wrote:

I haven't quite kept up with this Win32 feature.
Using RB2006, is there a built-in way to stop multiple application invocation ...

Sure is...

In App.Open:

    // appmutex As Mutex is a property of App
    appmutex = new Mutex( "YOUR APP'S UNIQUE IDENTIFIER STRING" )
    if NOT appmutex.TryEnter then
      // Already running...
      Quit
    end if

In App.Close:

    if appmutex <> Nil then appmutex.Leave

I also set a flag if TryEnter fails, and return immediately from App.OpenDocument if that flag is set. I'm not sure that's actually needed but at some point I guess I decided it was. I used to use declares for this so the way I go about it may just be a remnant of that old code - testing the Mutex again in OpenDocument should do just as well.

Frank.
<http://developer.chaoticbox.com/>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to