I wrote a Delphi application, says myapp.exe that should preferrably test when starting that there is no other instance running and, if so, halt. In a first stage, I used a counter in the registry that I put on 1 when starting and 0 when terminating and I tested it at startup. But if for some reason the program aborts, it can't be started because the flag is on 1 and I do not want to ask the user something like 'it looks like this is already running, do you want to continue ?'. I prefer to detect the other really running. Is there some API do check this ?