Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Start and Stop Services
Message
From
20/07/2015 16:39:05
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01622286
Message ID:
01622288
Views:
71
>How do you go about turning a service OFF in VFP ( by using code ). And.... turn a Service back On ???

It is pretty much the same thing as in .NET. However, you would need to run a DOS command like this:
        ' Enable the task
        loProcessFile.cWorkingDirectory = "c:\Windows\System32"
        loProcessFile.cFileName = "c:\Windows\System32\sc.exe"
        loProcessFile.cArguments = "\\" + lcIP + " start """ + lcService + """"
        If Not loProcessFile.Process() Then
            cMessage = loProcessFile.cMessage
            Return False
        End If
That is .NET code but you can easily adjust as needed.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform