[转帖]使本程序不出现在Windows的结束任务对话框中
| 要想做到这一点,你必须将你的程序注册为一个Service,这将通过把你的应用程序的Pro cess ID传递给RegisterService API
 声明部分:
 将一下这些代码复制到模块的声明部分
 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
 过程:
 调用MakeMeService使你的程序不出现在结束任务对话框中
 Public Sub MakeMeService()
 Dim pid As Long
 Dim reserv As Long
 Dim reserv As Long
 pid = GetCurrentProcessId()
 regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
 End Sub
 使你的程序重新出现在结束任务对话框中,调用UnMakeMeService
 Public UnMakeMeService()
 Dim pid As Long
 Dim reserv As Long
 pid = GetCurrentProcessId()
 regserv = RegisterServiceProcess(pid, _
 RSP_UNREGISTER_SERVICE)
 'End Code
 不要忘了在关闭你的程序时调用UnMakeService来注销其Service来释放系统资源
 
 |