Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Const RSP_SIMPLE_SERVICE = 1
Const RSP_UNREGISTER_SERVICE = 0
Private Sub Form_Load()
Dim curp As Long
curp = GetCurrentProcessId
RegisterServiceProcess curp, RSP_SIMPLE_SERVICE
End Sub