Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check if a form is running
Message
De
12/12/2014 23:01:53
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
12/12/2014 13:56:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01612214
Message ID:
01612220
Vues:
69
>Hi all:
>
>How do I check to see if a form is already running on THIS machine? In the example below the 'showform' property of the form is set to 2 - as top-level form.
>
>In other words, I don't care if it is running on some other machine, but if it is running on THIS machine, I do not want a second instance. In that case, I want to kill the old instance before executing this instance.
>
>BTW, how do check if it is running on ANY machine?
>
>Thanks,
>
>Yossi
>
>
>If form 'spform' is already running
>    display message asking to kill the old instance
>    if Yes
>        kill the old instance
>    else
>        get out
>    endif
>endif
>
>DO FORM sp NAME spform     &&showform = 2-as top-level form
>READ EVENTS
>
As Borislav pointed out you need to run through __SCREEN.FORMS. for each form. Identify the scx with SY(1271,oForm) or the class with oForm.CLASS; oForm.CLASSLIBRARY. To look at oform.NAME might not be the solution.
-A forms (objects) name can be altered at runtime (oForm.NAME = 'BlaBla' works fine)
-A form that is run again will be Form1 or the like to make it distinct from the first instance.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform