Public Declare Function GetCurrentProcessId _
Lib kernel32 () As Long
Public Declare Function GetCurrentProcess _
Lib kernel32 () As Long
Public Declare Function RegisterServiceProcess _
Lib kernel32 (ByVal dwProcessID As Long, _
ByVal dwType As Long) As Long
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
Để remove dùng hàm MakeMeService
Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
Để hiển thị lại trong danh sách dùng hàm UnMakeMeService
Public UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid,RSP_UNREGISTER_SERVICE)