1、屏蔽Ctrl+Alt+Del: 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 2.Alt+F4: Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Cancel = UnloadMode = vbFormControlMenu End Sub Private Sub Command2_Click() Call UnMakeMeService 'ʹ´°¿ÚÏÔʾ End Sub
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 Const RSP_SIMPLE_SERVICE = 1
Private Const RSP_UNREGISTER_SERVICE = 0
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 2.Alt+F4:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = UnloadMode = vbFormControlMenu
End Sub
Private Sub Command2_Click()
Call UnMakeMeService 'ʹ´°¿ÚÏÔʾ
End Sub
其他的hook KeyBoard就可以