ANN: Free unit that allows only one instance of the application

From: Oleg Subachev (oleg_at_urvb.ru)
Date: 07/12/04


Date: Mon, 12 Jul 2004 14:50:19 +0600

www.posolsoft.com/files/common/psl_1_STOP.zip

Prevents launching of the second instance of the application
but activates the first instance at the same time.
If second instance is launched with 'STOP' command line argument,
then the first instance is terminated but not activated.

Usage:

Changing in project file:

a) add psl_1_STOP in 'uses' clause

b) change project body as follows:

  if psl1_IS_1ST_INSTANCE( True ) then begin
// prevents launching of the second instance of the application from any
directory
// if psl1_IS_1ST_INSTANCE( False ) then begin
// prevents launching of the second instance of the application from the
same directory
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end
  else
    psl1_ACTIVATE_OR_STOP_1ST_INSTANCE;

-- 
Best regards,
Oleg Subachev
subachev@ural.ru


Relevant Pages

  • ANN: Free unit to allow only one instance of the application
    ... If second instance is launched with 'STOP' command line argument, ... then the first instance is terminated but not activated. ... change project body as follows: ... // prevents launching of the second instance of the application from any ...
    (borland.public.delphi.thirdpartytools.general)
  • Second instance of app referencing first instance of app?
    ... I've got an application that uses a Mutex to prevent multiple instances of ... the application from launching. ... second instance. ... At app startup, how can I grab a reference to another ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Free unit that allows only one instance of the application
    ... > Prevents launching of the second instance of the application ... > If second instance is launched with 'STOP' command line argument, ... > then the first instance is terminated but not activated. ... > b) change project body as follows: ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Search and Destroy.
    ... I'm convinced it's a Windows thing, primaril because FileLocatorPro ... I ran a second instance of Search (for the ... |>went back to the First Instance, deleted one file and the Second ...
    (microsoft.public.windowsxp.general)
  • Re: Search and Destroy.
    ... A temp file, one in use or non existent file is the most common reason ... |>went back to the First Instance, deleted one file and the Second Instance ... "Group Deletes" still report the same error. ...
    (microsoft.public.windowsxp.general)