[Gambas-user] "mutex" applications

Benoît Minisini gambas at ...1...
Wed Jun 6 19:05:31 CEST 2012


Le 06/06/2012 14:32, tobi a écrit :
> On Wed, 06 Jun 2012, Bruce wrote:
>> On Wed, 2012-06-06 at 12:38 +0200, Rolf-Werner Eilert wrote:
>>
>>> Hi Bruce,
>>>
>>> I have successfully used this code which is from Jussi Lahtinen. I built
>>> it into two of my applications, and it works reliably, at least under
>>> Gambas2 on our somewhat older system:
>>>
>>> PUBLIC SUB Form_Open()
>>> DIM sOutput AS String
>>>
>>>     EXEC ["pgrep", "-f", "-l", "-u", System.User.Name, "Stein3.gambas"]
>>> WAIT TO sOutput
>>>
>>>     IF Split(Trim$(sOutput), gb.NewLine).Count>  1 THEN
>>>       QUIT
>>>     ENDIF
>>>
>>> Just replace "Stein3" by your binary's name.
>>>
>>> Regards
>>>
>>> Rolf
>>
>>
>> Nice! A lot quicker than using gb.Desktop.
>>
>>
>> Sadly!
>> It doesn't solve the problem of activating the desired window.
>>
>> And there is a slight "weird", it doesn't detect an instance that is
>> running via the IDE.  No idea, but don't really care much, that's not
>> the problem.
>>
>> Ah well, back to Benoit's dbus suggestion.  Oh, how I hate having to
>> learn these "new" techo things.
>>
>> Back tomorrow.
>>
>> regards
>> Bruce

The good solution is using D-Bus. It is not very difficult actually.

As soon as I have time I will try to make a Gambas function in the 
gb.dbus component so that you can create "unique" application as simply 
as possible.

Regards,

-- 
Benoît Minisini




More information about the User mailing list