How to prevent running multiple instances?
How to prevent running multiple instances?
Are there any multyplatform solution n to prevent running multiple instances of app?
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: How to prevent running multiple instances?
Call CreatePort() to create a message port. If it fails, the port is already there and the app is already running.
Re: How to prevent running multiple instances?
Can you give any example?
I try to copy example from doc
And have error
Could not create message port!
I try to copy example from doc
Code: Select all
Function p_EventFunc(msg)
Switch msg.action
Case "OnUserMessage"
Switch msg.command
Case "EXIT"
DebugPrint("Exit received! Quitting now.")
End
Default
Local t = SplitStr(msg.args, "\0")
DebugPrint(msg.command, "called with", msg.argc, "argument(s)")
For Local k = 1 To msg.argc
DebugPrint("Argument", k .. ":", t[k - 1])
Next
EndSwitch
EndSwitch
EndFunction
CreatePort("MY_COOL_PORT_123")
InstallEventHandler({OnUserMessage = p_EventFunc})
Repeat
WaitEvent
Forever
Could not create message port!
Re: How to prevent running multiple instances?
no it is not use it&
I use only sql and zip plugins
I use only sql and zip plugins
Re: How to prevent running multiple instances?
So just put something like this toward the top of your code (before you open the display):
Code: Select all
Local var=?CreatePort("MY_PORT")
If var<>0 Then End()
Re: How to prevent running multiple instances?
Is not work.
App close before starting
Debugprint("My var"..var)
out 1256
Is it same number for all os?
App close before starting
Debugprint("My var"..var)
out 1256
Is it same number for all os?
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: How to prevent running multiple instances?
Are you on Mac OS or Linux? CreatePort() currently only works on Amiga and Windows.
Re: How to prevent running multiple instances?
on Mac
Are there solution for this os?
Are there solution for this os?
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: How to prevent running multiple instances?
Maybe set the "LSMultipleInstancesProhibited" switch to FALSE in the Info.plist of the app bundle?