Some templates (such as Capesoft SelfService) take care of limiting an app to one instance.
In an older, non-web app, I have this in a global embed:
INCLUDE('CWSYNCHM.INC'),ONCE
and code like this in a source procedure at the start of the app
Limiter &IMutex,AUTO
Result SIGNED,AUTO
LastErr LONG,AUTO
CODE
!--- other setup stuff
Limiter &= NewMutex('MyConfiguratorApplicationLimiterMutex',,LastErr)
IF Limiter &= NULL
MESSAGE ('ERROR: Mutex can not be created ' & LastErr)
ELSE
Result = Limiter.TryWait(50)
IF Result <= WAIT:OK !Do Everything
UpdateGlobals() ! my setup proc
AuditAppAccess() ! my audit proc
ThisFrame() ! my app MDI frame - run the app
Limiter.Release() ! release after MDI frame closes
ELSIF Result = WAIT:TIMEOUT
MESSAGE('This program is already running on your computer.','Already Running',ICON:Exclamation)
ELSE
MESSAGE('Waiting is failed ' & Result) !show Result
END
Limiter.Kill()
END
RETURN
Yeah thats virtually identical to the example in the helps docs, so is this the accepted way to use it for now, until the template is completed in a later edition?
I think I had a template some years ago which just used the api’s directly and applied the mutex that way.