Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Preventing Multiple Launches
Message
De
01/12/1999 05:47:31
 
 
À
30/11/1999 12:59:12
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00296974
Message ID:
00297230
Vues:
33
Hi,

I encountered the same problem, and with some help and inspiration from I do not remember who, it was resolved by DDE-calls: works fantastic!

programming sample: (the application was called "MASCL.EXE")

*-----------------------
* Check if program is already running on this machine
*-----------------------
=DDESETOPTION('SAFETY',.F.)
checkval=DDEINITIATE('MASCL','System')

IF checkval#-1
=MESSAGEBOX("MASCL already running!",16)
QUIT
ENDIF

*-----------------------
* If OK: set DDE-flag
*-----------------------
=DDESETSERVICE('MASCL','DEFINE')

*********** mainprogram text comes here
** once you get here, no second instance can be called ...

** end off application:
*------------------------
* remove DDE-flag
*-----------------------
=DDESETSERVICE('MASCL','RELEASE')

I hope this helps,
Best regards from Belgium
Ivo Hubert


>The application resides on a network drive, and the user launches it from a desktop icon. Due to the 2-3 second start time, the impatient user tends to launch the application a second or third time. To make matters worse, the READ EVENTS of the first form prevents the READ EVENTS on the second form from starting and the user is looking with an inert (second) version of the form.
>
>I've tried wexist("MyScx_name") and wexist("MyScx_Caption") and neither are available to determine if the program is already running. Even if that worked, would the second launch be able to detect the first window if it hadn't yet opened?
>
>Is there a simple way to prevent multiple launches, or do I have to create a process that can check if the program is running?
Ivo HUBERT
G.S.P. n.v., Development dep.
Antwerp
Belgium
ivo.hubert@skynet.be
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform