Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using advapi32.dll to install a service
Message
From
21/09/2006 15:27:22
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01155465
Message ID:
01156164
Views:
28
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform