[Gambas-user] How prevent application from opening twice
Stefano Palmeri
rospolosco at ...152...
Wed Apr 22 13:19:54 CEST 2009
Il mercoledì 22 aprile 2009 13:11:59 Siti Fatimah ha scritto:
> Hi all,
> I need to prevent my program from opening twice. Is there a best method to
> determine whether a program has already run ?
>
> Thanks.
> sfatimah
>
I use this:
DIM sShellOutput as String
SHELL "pgrep -f -U " & User.Name & " " & Application.Args[0] TO sShellOutput
IF Split(Trim$(sShellOutput), "\n").Count > 1 THEN
'already running
'take action here
ENDIF
This check for the user. If you want to check system
wide, do:
SHELL "pgrep -f " & Application.Args[0] TO sShellOutput
Bye,
Stefano
>
>
> Berselancar lebih cepat. Internet Explorer 8 yang dioptimalkan untuk
> Yahoo! otomatis membuka 2 halaman favorit Anda setiap kali Anda membuka
> browser. Dapatkan IE8 di sini!
> http://downloads.yahoo.com/id/internetexplorer
> ---------------------------------------------------------------------------
>--- Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list