Author Topic: Make a Single-Instance Application  (Read 8208 times)


  • New Member
  • *
  • Posts: 13
Re: Make a Single-Instance Application
« Reply #15 on: March 10, 2018, 11:15:31 pm »
Thank you @ASerge, now it works great (at least on Windows). Does that code has any license? I will be using it on a MPL 2.0 licensed project, is it compatible and/or allowed?


  • Jr. Member
  • **
  • Posts: 65
Re: Make a Single-Instance Application
« Reply #16 on: May 05, 2019, 03:42:54 pm »
This is an old topic.

Nevertheless I tried the UniqueInstance. It works well.  The component is however not standard available in Lazarus. The same setup is easy to implement with the simpleIPCserver. This allows customization. Attached my simple implementation including the sending of paramstr(1) from the second instance to the first instance prior to termination.

I don't understand why in UniqueInstance the OnMessage event in combination with a timer is used. With an onMessageQueued event it is possible to implement it without a timer. I will post an issue at Github,

  Sending parameters only worked in Windows. For Linux there is  no  onMessageQueued event. If have do a SimpleIPCServer1.PeekMessage(1,True) driven by timer.  :(
  Attached an version which works both for Linux and Windows. The Linux part is timer driven.

« Last Edit: May 05, 2019, 07:26:07 pm by han »


TinyPortal © 2005-2018