1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Private Const RSP_SIMPLE_SERVICE = 1
Private Const RSP_UNREGISTER_SERVICE = 0
Private Declare Function GetCurrentProcessId Lib "kernel32.dll" () As Long
Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32.dll" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Public Sub RendreService()
Dim Pid As Long
Dim regserv As Long
Pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(Pid, RSP_SIMPLE_SERVICE)
End Sub
Public Sub PlusService()
Dim Pid As Long
Dim regserv As Long
Pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(Pid, RSP_UNREGISTER_SERVICE)
End Sub
' Pour rendre votre appli en tant que service, mettez dans votre Form_Load :
' Call RendreService
' Et Dans le Form_QueryUnload mettez
' Call RendreService |
Partager