程序说明: 这个程序比较简单,只使用了GetCurrentProcessId 和 RegisterServiceProcess 两个函数就可以达到。 这种方法只能在 Windows98 中运行,在 Windows2000中是不行的 程序代码: Module1 Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long 下面代码为隐藏 regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE) '恢复隐藏 Private Sub Command1_Click() Private Sub Command2_Click() Private Sub Form_Load()
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() '取的当前运行的程序Id
对当前的程序传入 RSP_SIMPLE_SERVICE 消息,使此程序
从任务列表中隐藏
End Sub
Public Sub UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
原理同上
End Sub
Call MakeMeService
End Sub
Call UnMakeMeService
End Sub
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Form1.Top = Screen.Height / 2 - Form1.Height / 2
End Sub