Buat 2 Command Buttons pada form anda.
Command Button yang pertama, berfungsi untuk menyembunyikan, sementara yang kedua untuk mengembalikannya ke semula.
Command Button yang pertama, berfungsi untuk menyembunyikan, sementara yang kedua untuk mengembalikannya ke semula.
Pada module, tuliskan kode ini :
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
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
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID _
As Long, ByVal dwType As Long) As Long
Kemudian, klik pada Form program anda, dan masukkan kode ini dibelakangnya :
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
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
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()
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
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
HideApp (False)
End Sub
Setelah didebug, anda bisa melihat hasilnya, program anda bisa tidak terlihat pada process list pada Task Manager.
Moga Bermanfaat... :)