Re:Re: preventing Delphi app from running more than once

[ Delphi Forum ]

Posted by webmaster Guido on May 05, 2003 at 18:43:30:

In Reply to: Re: preventing Delphi app from running more than once posted by Rbrrneck on May 04, 2003 at 08:57:15:

: You just have to improvize...

: put this function in your program:
: when the application is started it checks if a file named asd.chk exists, if not then it creates it, if it exists, then it shuts down...dont forget to delete that file whan you close your app...

The disadvantage of this solution: if the application crashes (or if Windows crashes) before the "flag" file is deleted, then it becomes impossible to restart the application. So you would have to write a utility that erases the flag-file, and tell the user (or the administrator) to launch the utility in case the main app can't be started.

Related Articles and Replies:

[ Delphi Forum ]