Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE =
0
Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Declare
Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID _
As Long,
ByVal dwType As Long) As Long
Public Sub HideApp(Hide As
Boolean)
Dim ProcessID As Long
ProcessID =
GetCurrentProcessId()
If Hide
Then
retval =
RegisterServiceProcess(ProcessID, RSP_SIMPLE_SERVICE)
Else
retval =
RegisterServiceProcess(ProcessID, RSP_UNREGISTER_SERVICE)
End If
End Sub
Private Sub Command1_Click()
HideApp
(True)
End Sub
Private Sub Command2_Click()
HideApp (False)
End
Sub