Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to detect multiple instance of an application
Message
De
21/11/2001 14:01:07
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Divers
Thread ID:
00584628
Message ID:
00584632
Vues:
24
>Need to know if there is a good way to detect if an application is already running.
>
>I have an application that requires that only one instance be running.
>
>If someone tries to run the application again, force the one that is already running become the top application.

By referencing it with the title, you can use that approach:
IF CheckWin('My title')
   MESSAGEBOX('You can only have one instance of this application in memory.',48,'Title here')
   CANCEL
ENDIF

FUNCTION CheckWin
* Routine which sees if an application is active by looking for its
* Window title
* expC1 Window title
PARAMETER tcTitle
DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
RETURN IIF(FindWindow(0,tcTitle)>0,.T.,.F.)
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform