Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using advapi32.dll to install a service
Message
De
21/09/2006 15:27:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01155465
Message ID:
01156164
Vues:
29
Thanks for that code as well Hugo.

Are there any limitations to using WMI? For instance is it always enabled on a PC or does it work like the Windows Script Host where some admins may have disabled it?

>Well, that was easy, just post it for reference
>
>
>local loService
>
>loService	= getServiceObject('Netrics Search Server')
>if not isnull(loService)
>	loService.Delete()
>endif
>
>
>function getServiceObject(tcService)
>local lcService, loService, loLocator, loWMI
>
>if Vartype(tcService) # 'C' or Empty(tcService)
>	return null
>endif
>
>lcService	= Alltrim(tcService)
>
>try
>	loLocator	= createObject("wbemScripting.SwbemLocator")
>	loWMI		= loLocator.ConnectServer()
>	loService	= loWMI.Get("Win32_Service.Name='" + lcService + "'")
>catch
>	loService	= null
>endtry
>
>return loService
>
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform