by Tomorroware Software (1 Submission)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (23 Votes)
This simple code will disable any service on the local machine, good to use to disable a firewall so your app can access the web to check for pirate serial without the user knowing etc, it will also start a service. To find a servicename goto Control Panel > Administrator Tools > Services..
Inputs
The ServiceName of a service you wish to END / START
Assumes
Service Name!
Code Returns
Nothing
Side Effects
Disables service, or starts one.
API DeclarationsNone!
Private Sub Command1_Click()
'stops Norton Antivirus
StopService "Norton Antivirus Auto Protect Service"
End Sub
Private Sub Command2_Click()
'starts antivirus
StartService "Norton Antivirus Auto Protect Service"
End Sub
Sub StopService(ServiceName As String)
a = """" & ServiceName & """"
'uses the NET STOP function to stop the service
Shell "net stop " & a, vbHide
End Sub
Sub StartService(ServiceName As String)
a = """" & ServiceName & """"
'uses the NET START function to start the service
Shell "net start " & a, vbHide
End Sub