Here is one possible avenue to pursue:
Leave the file open when the program is running... don't close the file until the screensaver program is finished.
That means that if another copy of the screensaver is executed, that specific file will be locked (it will already be opened by another program, so it cannot be opened by the second one). If fileout = 0 (I believe, this is off of the top of my head, check the docs yourself), it means the file cannot be opened. If you CAN open it, even if it exists, it means the other screen saver is not running...
Leave the file open when the program is running... don't close the file until the screensaver program is finished.
That means that if another copy of the screensaver is executed, that specific file will be locked (it will already be opened by another program, so it cannot be opened by the second one). If fileout = 0 (I believe, this is off of the top of my head, check the docs yourself), it means the file cannot be opened. If you CAN open it, even if it exists, it means the other screen saver is not running...