[Gambas-user] Running program

Johny Provoost johny.provoost at ...27...
Wed Nov 7 12:22:43 CET 2012


Op 07-11-12 12:12, Cogier schreef:
> Can you tell me the best way to spot that there is another instance of the
> same Gambas program running at the same time.
>
> I have users who sometimes start the same program written in Gambas twice
> and I would like the 2nd instance to pop up a message saying that there is
> already a copy of the program running.
>
> Thanks for your help.

Got this from one of the listmembers long time ago. Forgot his name 
(shame on me)

Public Sub Form_Open()
Dim sOutput As String
     'Check if the program not already started
     Exec ["pgrep", "-f", "-l", "NameProgram"] Wait To sOutput
     If Split(Trim$(sOutput), gb.NewLine).Count > 1 Then
         FMain.TempString = ("Program already started")
         Message.Info(FMain.TempString)
         Quit
     Endif
End


Johny Provoost






More information about the User mailing list