...if you want to detect whether your own app is running from within itself, for example, if you've written a screen saver and need to check whether itself should run or not, use a Mutex. Here's an example, taken from screen saver - this code is put in the DPR file.
var
CmdLine: String;
MutHandle: THandle = 0;
begin
MutHandle := OpenMutex(MUTEX_ALL_ACCESS, False, 'Screen Saver.Boring');
if MutHandle = 0 then
MutHandle := CreateMutex(nil,false,'Screen Saver.Fun')
else Exit;
:
lou