!************************************** ! Name: RunOnlyOnce: via Mutex. ! Description:Code: Another, different, RunOnlyOnce solution. ! By: David Ward (from psc cd) ! ! ! Inputs:None ! ! Returns:None ! !Assumes:None ! !Side Effects:None !************************************** So here it is then, a 3 step process. [1] Put the following function declaration in the INTERFACE section of any unit of your project, immediately prior to the IMPLEMENTATION section header; Function AlreadyRunning: Boolean; [2] and the following function in the IMPLEMENTATION section of that same unit; Function AlreadyRunning: Boolean; Var MutexHandle: THandle; Begin Result:=False; MutexHandle:=CreateMutex(nil,TRUE,'NameofMyProgram-version1.2.3'); // 'NameofMyProgram-version1.2.3' can be any text string, it just needs to be unique to each program. If MutexHandle<>0 then If GetLastError=ERROR_ALREADY_EXISTS then Result:=True; // Yes, this Mutex does already exist, this program is already running! end; [3] Finally, in your Project source file (the .DPR) in the main "Begin ... End." clause do this; Begin // existing line If not AlreadyRunning then begin // inside here will be ALL the existing code that already was in the main "Begin ... End." clause. end; End. // existing line