首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

怎样在XP实现禁用Ctrl+Alt+Del解决方案

2012-03-22 
怎样在XP实现禁用Ctrl+Alt+Del怎样在XP实现禁用Ctrl+Alt+Del[解决办法]Option ExplicitAPI 宣告Private De

怎样在XP实现禁用Ctrl+Alt+Del
怎样在XP实现禁用Ctrl+Alt+Del

[解决办法]
Option Explicit

' API 宣告

Private Declare Sub keybd_event Lib "user32 " (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Form_Load()

ControlTask True

End Sub

Private Sub Form_Unload(Cancel As Integer)

ControlTask False

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 91 Or KeyCode = 92 Then

keybd_event 20, 0, 2, 0 ' M$

keybd_event 91, 0, 2, 0 ' M$

End If

If Shift = 4 And KeyCode = 18 Then keybd_event 18, 0, 2, 0 'Alt+Tab

If Shift = 2 And KeyCode = 17 Then keybd_event 17, 0, 2, 0 'Ctrl+Esc

If Shift = 4 And KeyCode = 115 Then keybd_event 115, 0, 2, 0 'Alt+F4

If KeyCode = 112 Then keybd_event 112, 0, 2, 0 'F1

KeyCode = 0

End Sub

Public Sub ControlTask(ByVal Show As Boolean)

Dim strKey As String

Show = Not Show

strKey = "HKCU\software\microsoft\windows\currentversion\policies\ "

With CreateObject( "WScript.Shell ")

.RegWrite strKey & "system\DisableTaskMgr ", Show

.RegWrite strKey & "Explorer\NoLogoff ", Show

.RegWrite strKey & "Explorer\NoClose ", Show

.RegWrite strKey & "system\DisableLockWorkstation ", Show

.RegWrite strKey & "system\DisableChangePassword ", Show

.RegWrite strKey & "Explorer\NoViewContextMenu ", Show

.RegWrite strKey & "Explorer\NoChangeStartMenu ", Show

.RegWrite strKey & "Explorer\NoRun ", Show

.RegWrite strKey & "Explorer\NoSetTaskbar ", Show

End With

End Sub

热点排行