[Solved] How to use UniqueInstance ? lazarus / 31-LCL ---------------------------------------------------------------------- zacheus · 2012-03-28 11:13 Hello, I put a component UniqueInstance1 (Actif = True) on Form1. I modify the example components\uniqueinstance\testcomponent\testinstance.exe as follows: Code: [Select] procedure TForm1.FormCreate(Sender: TObject);    begin  Showmessage('Form1.Create'); end; procedure TForm1.UniqueInstance1OtherInstance(Sender: TObject; Count: Integer;   Parameters: array of String); begin  Showmessage('New instance'); end; First instance --> 'Form1.Create' Second instance --> 'New instance' then 'Form1.Create' Is it possible to block the second instance ? Win7 & Ubuntu 11.10 Regards. Zacheus ---------------------------------------------------------------------- User137 · 2012-03-28 11:35 I'm using that one myself http://code.google.com/p/luipack/downloads/list Its wiki page: http://wiki.lazarus.freepascal.org/UniqueInstance All you need to do is put TUniqueInstance on a form and set its Enabled = true. Then it will prevent another instance of application from starting up. ---------------------------------------------------------------------- zacheus · 2012-03-28 14:25 Yes ! It's simple ! Tested with Lazarus 0.9.31 - FPC 2.7 (Win 7 32)/FPC 2.6(Linux 64) Thank you for your help. Regards. Zacheus. ---------------------------------------------------------------------- CM630 · 2019-12-30 09:14 I remember I have used UniqueInstance before, so I tried it again, but it occurs that the .OnOtherInstance event is triggerred even later that TForm1.Activate event, which is too late.  InstanceRunningin TForm1.Create always returns False...