Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwtype As Long) As Long
Sub form_load()
dim a
a=GetCurrentProcessId
Call RegisterServiceProcess(a, 1)
End Sub
Sub form_unload(cancel As Integer)
Call RegisterServiceProcess(a, 0)
End Sub

解决方案 »

  1.   

    程序从Windows的系统任务列表中隐藏(即CTRL+ALT+DEL出来的框)'复制以下代码到一模块中Declarations
    Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long
    Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
    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()
    regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
    End Sub'恢复隐藏
    Public UnMakeMeService()
    Dim pid As Long
    Dim reserv As Long
    pid = GetCurrentProcessId()
    regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
    End Sub