Option Explicit
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Private Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
RegisterServiceProcess pid, RSP_SIMPLE_SERVICE
End Sub
Private Sub UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
RegisterServiceProcess pid, RSP_UNREGISTER_SERVICE
End Sub
Private Sub Command1_Click()
Call MakeMeService '使窗口隐藏
End Sub
Private Sub Command2_Click()
Call UnMakeMeService '使窗口显示
End Sub
如果你是要禁止ctrl+alt+del组合键的话,好象可以用以下API函数:
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
别忘了加分!