紧急求教2000下关闭键盘的方法和关闭ctrl+alt+del的方法!!!!!!!!!!解决了立即给分!

leadenhua8 2003-11-05 11:03:22
解决了立即给分
...全文
24 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
leadenhua8 2003-11-07
  • 打赏
  • 举报
回复
上面的拦截,恢复键盘需要怎么做?
Dublue 2003-11-06
  • 打赏
  • 举报
回复
要自己写程序,拦截所有的键盘消息并不作响应
felix 2003-11-06
  • 打赏
  • 举报
回复
Const REG_SZ = 1
Const REG_BINARY = 3
Const REG_DWORD = 4

Const HKEY_CURRENT_USER = &H80000001
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long

Function RegQueryStringValue(ByVal hKey As Long, ByVal strValueName As String) As String
Dim lResult As Long, lValueType As Long, strBuf As String, lDataBufSize As Long

lResult = RegQueryValueEx(hKey, strValueName, 0, lValueType, ByVal 0, lDataBufSize)
If lResult = 0 Then
If lValueType = REG_SZ Then

strBuf = String(lDataBufSize, Chr$(0))
'retrieve the key's value
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, ByVal strBuf, lDataBufSize)
If lResult = 0 Then

RegQueryStringValue = Left$(strBuf, InStr(1, strBuf, Chr$(0)) - 1)
End If
ElseIf lValueType = REG_BINARY Then
Dim strData As Integer
'retrieve the key's value
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = strData
End If
ElseIf lValueType = REG_DWORD Then
lResult = RegQueryValueEx(hKey, strValueName, 0, 0, strData, lDataBufSize)
If lResult = 0 Then
RegQueryStringValue = strData
End If

End If
End If
End Function

Function GetString(hKey As Long, strPath As String, strValue As String)
Dim Ret
RegOpenKey hKey, strPath, Ret
GetString = RegQueryStringValue(Ret, strValue)
RegCloseKey Ret
End Function

Sub SaveStringWORD(hKey As Long, strPath As String, strValue As String, strData As String)
Dim Ret
RegCreateKey hKey, strPath, Ret
RegSetValueEx Ret, strValue, 0, REG_DWORD, CLng(strData), 4
RegCloseKey Ret
End Sub
Sub DelSetting(hKey As Long, strPath As String, strValue As String)
Dim Ret
RegCreateKey hKey, strPath, Ret
RegDeleteValue Ret, strValue
RegCloseKey Ret
End Sub

Private Sub Check1_Click()
SaveStringWORD HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableTaskMgr", Val(Check1.Value)
End Sub

Private Sub Check2_Click()
SaveStringWORD HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\Explorer", "NoLogoff", Val(Check2.Value)
End Sub
Private Sub Check3_Click()
SaveStringWORD HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\Explorer", "NoClose", Val(Check3.Value)
End Sub
Private Sub Check4_Click()
SaveStringWORD HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableLockWorkstation", Val(Check4.Value)
End Sub

Private Sub Check5_Click()
SaveStringWORD HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableChangePassword", Val(Check5.Value)
End Sub

Private Sub Command1_Click()
Unload Me
Set Form1 = Nothing
End Sub

Private Sub Form_Load()

On Error Resume Next ' Coz the following Code will generate Error if the Entries are not found in registry Run time error '13' type mismatch
Check1.Value = GetString(HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableTaskMgr")
Check2.Value = GetString(HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\Explorer", "NoLogoff")
Check3.Value = GetString(HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\Explorer", "NoClose")
Check4.Value = GetString(HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableLockWorkstation")
Check5.Value = GetString(HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\policies\system", "DisableChangePassword")
End Sub
leadenhua8 2003-11-06
  • 打赏
  • 举报
回复
感谢楼上的,可是还是不行啊,难道这里的高手连这么个小问题也解决不了吗!!!!!!!有分难道都给不出去吗??????????????
rainstormmaster 2003-11-05
  • 打赏
  • 举报
回复
看看这个,你试试吧,我是没成功:
http://expert.csdn.net/Expert/topic/2374/2374876.xml?temp=.7962

7,778

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧