by Sanx (10 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(6 Votes)
**UPDATED** A small OCX that can be used to Stop, Start, Pause, Resume, query the current state and change the start type of any Windows NT Service. Works on NT4, 2000 and XP.
API DeclarationsDeclare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal strMachineName As String, ByVal strDBName As String, ByVal lAccessReq As Long) As Long
Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As Long, ByVal strServiceName As String, ByVal lAccessReq As Long) As Long
Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA" (ByVal hService As Long, ByVal lNumServiceArgs As Long, ByVal strArgs As String) As Boolean
Declare Function ControlService Lib "advapi32.dll" (ByVal hService As Long, ByVal lControlCode As Long, lpServiceStatus As SERVICE_STATUS) As Boolean
Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hHandle As Long) As Boolean
Declare Function QueryServiceStatus Lib "advapi32.dll" (ByVal hService As Long, lpServiceStatus As SERVICE_STATUS) As Boolean