vb屏蔽键盘上部分键

1、我要能够同时屏蔽win,alt+f4,ctrl+alt+f4的源码2、如果1实现了,如何进一步屏蔽各种组合键我已将鼠标限制在一个窗口内了,通过输入密码解除锁定如何屏蔽... 1、我要能够同时屏蔽win,alt+f4,ctrl+alt+f4的源码
2、如果1实现了,如何进一步屏蔽各种组合键
我已将鼠标限制在一个窗口内了,通过输入密码解除锁定
如何屏蔽ctrl+alt+delete
展开
 我来答
peaset
2009-04-12 · TA获得超过2148个赞
知道大有可为答主
回答量:3315
采纳率:0%
帮助的人:0
展开全部
分二步:
1、建立一个模块,然后复制下面代码
Option Explicit
Private Declare Function GetKeyState Lib "User32" _
(ByVal nVirtKey As Long) As Integer
Public Declare Function SetWindowsHookEx Lib "User32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "User32" (ByVal hHook As Long) As Long
Public Declare Function CallNextHookEx Lib "User32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, ByVal lpvSource As Long, ByVal cbCopy As Long)
Public Type KEYMSGS
vKey As Long
sKey As Long
flag As Long
time As Long
End Type
Public Const WH_KEYBOARD_LL = 13
Public Const VK_LWIN = &H5B
Public Const VK_RWIN = &H5C
Public Const HC_ACTION = 0
Public Const HC_SYSMODALOFF = 5
Public Const HC_SYSMODALON = 4
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_SYSKEYDOWN = &H104
Public Const WM_SYSKEYUP = &H105

Public P As KEYMSGS
Public lHook As Long

Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fEatKeystroke As Boolean

If (nCode = HC_ACTION) Then
If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
CopyMemory P, ByVal lParam, Len(P)
Select Case P.vKey
Case vbKeyF4
If (GetKeyState(vbKeyMenu) And &H8000) <> 0 Then '如果按了Alt+F4键
fEatKeystroke = True '就吃了
End If
End Select
End If
End If
If fEatKeystroke Then
LowLevelKeyboardProc = -1
Else
LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
End If
End Function

2、在Form中程序调用如下:

Private Sub Form_Load()
lHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)'设置键盘勾子
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx lHook''取消键盘勾子
End Sub

稍微进一步修改,你可以的吧……
屏蔽F4 和 WIN 就可以了

参考资料: http://hi.baidu.com/peaset

Winnip888
2009-04-19 · TA获得超过1996个赞
知道小有建树答主
回答量:676
采纳率:0%
帮助的人:564万
展开全部
我可以帮你完成,但是必须先选择我最佳。

屏蔽也C+a+d也可以。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
frost_007
2009-04-12 · TA获得超过479个赞
知道小有建树答主
回答量:431
采纳率:0%
帮助的人:440万
展开全部
peaset 十二级的果然厉害。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式