Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is VFP Running?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01428120
Message ID:
01429199
Vues:
70
Any user can run it but I doubt that it'll work for non-admin users.

>Sergey - can non-admin Vista users run this code? I am looking for a FindWindow replacement, which does not work with Vista.
>
>
>>>* 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()
>>>loWMI.Security_.ImpersonationLevel = 3 && Impersonate
>>>
>>>
>>>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
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform