Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using advapi32.dll to install a service
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01155465
Message ID:
01156124
Views:
26
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
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform