How to prevent running multiple instances?

Discuss any general programming issues here
User avatar
fingus
Posts: 269
Joined: Fri Sep 16, 2011 9:53 am

Re: How to prevent running multiple instances?

Post by fingus »

I use this on top of my Code, it´s working on AmigaOS/Windows:

Code: Select all

SendMessage("YOUR_PROGRAMMNAME_HERE", "DO_SOMETHING", "Argument1")
code=GetLastError()
If code=0
  SystemRequest("Error!", "Program is already running","End")
  End
EndIf

CreatePort("YOUR_PROGRAMMNAME_HERE")
Post Reply