Avoid multiple instances...?
BlitzMax Forums/BlitzMax Programming/Avoid multiple instances...?
| ||
I did this to avoid multiple instances of my game running at the same time on Windows, which does work:' avoid two instances of the game... at least on windows ?Win32 Extern "Win32" Function FindWindow%(func$z,func2$z) = "FindWindowA@8" End Extern Local win%=FindWindow(Null,"WINDOW_TITLE_HERE") If (win) Then Print "game already running!"; End ? Does anyone have an idea how the same could be achieved on Mac? |
| ||
In one of the screensaver templates/modules floating around the code archives I remember there was something setting a `Process Lock` so that the process could only run the exe once? |
| ||
Other people have done it the quick and dirty way which is to write a file to disk to signify that you're running, then delete it upon exit. (and be careful with accidental exits without deletion). Then detect if the file exists before launching. Last edited 2011 |
| ||
This is what you might be looking for?! http://www.blitzbasic.com/codearcs/codearcs.php?code=2787 |
| ||
What happens if they have an unrelated program that happens to have the same window title? |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=79081 |
| ||
Hmmm... so on MAC the OS prevent you from launching a second instance? That's good to know :) |