Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify if application is running
Message
De
10/02/2006 13:11:19
Arlei Silva
Chevron Oronite Brasil Ltda.
Capuava, Brésil
 
 
À
08/02/2006 07:29:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Divers
Thread ID:
01094586
Message ID:
01095504
Vues:
12
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all !
>
>I need verify if one app is running in the client machine !
>because the application cannot be executed in the same PC a time more than at the same time.
>
>thank's


Hi Welington,

You can do the following:
At the initial program / form of your application, insert the following code:
if ISAPPRUNNING()
	=MSGOK("Este aplicativo já está em uso.")
	quit
endif
Here goes the code for function ISAPPRUNNING()
function ISAPPRUNNING

#define ERROR_ALREADY_EXISTS 183
declare integer GetLastError in WIN32API
declare integer CreateSemaphore in WIN32API string @ lpSemaphoreAttributes, long lInitialCount, long lMaximumCount, string @ lpName
C_SEMAPHOREID = "Put-Some-String-To-Uniquely-Identify-Your-Application-Here"
N_RUNNINGPROCESS = CREATESEMAPHORE(0, 0, 1, C_SEMAPHOREID)
return (N_RUNNINGPROCESS # 0 and GETLASTERROR() == ERROR_ALREADY_EXISTS)
You have to change the "Put-Some-String-To-Uniquely-Identify-Your-Application-Here" for some string that identifies your application (for example "Mala Direta VFP")

Regards,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform