<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-09-29 10:35 GMT-03:00 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On Tue, 29 Sep 2015, Juha Manninen wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tue, Sep 29, 2015 at 2:50 PM, Michael Van Canneyt<br>
<<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am not proposing to make a new class.<br>
I want a property "SingeInstance" in CustApp which activates this<br>
automatically.<br>
</blockquote>
<br>
I had the very same idea when this was discussed a long time ago in<br>
Lazarus list.<br>
Martin Friebe noted that every application would then depend on this<br>
single-instance IPC code.<br>
It was a valid point. There should not be such a dependency.<br>
</blockquote>
<br></span>
For simpleIPC, yes. But the new implementation has no dependencies except sysutils, classes. So the argument becomes void.<br>
<br>
That's why I was glad with Ondrej's implementation.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The right way is to use a drag-and-drop LCL component like the one<br>
from Luiz Américo.<br>
</blockquote>
<br></span>
That is IMHO a completely wrong implementation for 2 reasons:<br>
<br></blockquote><div><br></div><div>It can be used without the component. The component is just a convenience.<br> See the examples<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1. Using a LCL component means that you must instantiate a form/datamodule first.<br>
By that time, a database connection may already have been made (just<br>
to name something), which is exactly what you want to avoid.<br>
<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The check for single instance should be done before the first form is created.<br></blockquote><div><br></div><div>It can be done<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2. Then it is only available in visually designed applications.<br>
Services, website servers and custom console apps are non-visual.<br>
I am specificially thinking FastCGI processes.<br>
<br></blockquote><div><br></div><div>See above<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All these have in common that they descend from TCustomApplication.<br>
<br></blockquote><div><br></div><div>And console apps without TCustomApplication?<br></div><div> </div>Luiz<br></div><br></div></div>