Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you insure you run only one instance of a form?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00256254
Message ID:
00262011
Vues:
19
Dear Jeff,

You can use the windows API to see if a window with the same name that your application has is already open, and exit your main program if it is:

* Program-ID..: MAIN.PRG
* Purpose.....: Entry point for my accounting system

...

DECLARE INTEGER ShowWindow IN win32api INTEGER,INTEGER
LOCAL AlreadyRunning
AlreadyRunning = Is_Run32('Pinter Accounting')
IF AlreadyRunning > 0
=ShowWindow(AlreadyRunning,2)
=ShowWindow(AlreadyRunning,1)
RETURN
ENDIF

Good Luck,

Les Pinter
Publisher, Les Pinter's Database Journal
Les Pinter
(650) 344-3969
Les@LesPinter.com for consulting bookings.
www.LesPinter.com.

Watch for my forthcoming book on "Developing Database Applications in VFP and VB.NET".
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform