Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwtype As Long) As Long
Sub form_load()
dim a
a=GetCurrentProcessId
Call RegisterServiceProcess(a, 1)
End Sub
Sub form_unload(cancel As Integer)
Call RegisterServiceProcess(a, 0)
End Sub
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwtype As Long) As Long
Sub form_load()
dim a
a=GetCurrentProcessId
Call RegisterServiceProcess(a, 1)
End Sub
Sub form_unload(cancel As Integer)
Call RegisterServiceProcess(a, 0)
End Sub
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'下面代码为隐藏
Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub'恢复隐藏
Public UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
End Sub