[Gambas-user] How prevent application from opening twice
Siti Fatimah
sfatimah99 at ...43...
Wed Apr 22 13:47:05 CEST 2009
Thank's Stefano ..for ur quick response. It really worked....
Best Regards,
sfatimah
--- Pada Rab, 22/4/09, Stefano Palmeri <rospolosco at ...152...> menulis:
Dari: Stefano Palmeri <rospolosco at ...152...>
Topik: Re: [Gambas-user] How prevent application from opening twice
Kepada: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
Tanggal: Rabu, 22 April, 2009, 4:19 AM
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
------------------------------------------------------------------------------
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
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
More information about the User
mailing list