Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to check its opened or release program
Message
De
22/03/2008 04:09:12
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01266342
Message ID:
01304535
Vues:
32
thx, sergey
it's great
>If you can use WMI
>
>lcExeName = "instgb5.exe"
>
>* Is EXE running
>? IsExeRunning(lcExeName)
>...
>* Terminate EXE if it's running
>? IsExeRunning(lcExeName, .T.)
>...
>RETURN
>
>FUNCTION IsExeRunning(tcName, tlTerminate)
>LOCAL loLocator, loWMI, loProcesses, loProcess, llIsRunning
>loLocator 	= CREATEOBJECT('WBEMScripting.SWBEMLocator')
>loWMI		= loLocator.ConnectServer()
>loProcesses	= loWMI.ExecQuery([SELECT * FROM Win32_Process WHERE Name = '] + tcName + ['])
>llIsRunning = .F.
>IF loProcesses.Count > 0
>	FOR EACH loProcess in loProcesses
>		llIsRunning = .T.
>		IF tlTerminate
>			loProcess.Terminate(0)
>		ENDIF
>	ENDFOR
>ENDIF
>
>RETURN llIsRunning
>
>>
>>RUN instgb5.exe
>>
>>I will run a .exe at the beginning of my system ( the .exe file to help me to view some website in chinese )
>>
>>[ Question 1. ]
>>How to release the instgb5.exe when i exit my system
>>
>>[ Question 2. ]
>>I found that... if i run my system two/three times, the instgb5.exe will run two/three times too, actually no need to run instgb5.exe again.
>>How can i detect the (instgb5.exe) was running in Window ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform