vb.net中 如何屏蔽windows的ctrl+alt+del 热键笨办法:
加个菜单控件,设置个空选项
再把这个菜单选项的快捷键设置成ctrl+alt+del
vb.net如何屏蔽shift enterCnPack组件包中有KeyBlocker组件,可以键盘hook的方式屏蔽一些键,但对CTRL+ALT+DEL无效 。
例子在cnpack\Examples\KeyBlocker中 。
VB.NET键盘Hook成功后拦截不了组合键最简单的就是把属性改一下,效果跟无框的差不多 。
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
Me.ControlBox = False
Me.MaximizeBox = False
Me.Text = ""
【vb.net屏蔽组合键 vba屏蔽所有告警】至于hook的问题,它确实是比系统慢了一步得到消息,当前线程或全局的都一样,不过你可以先拦截Windows键或者Up键其中一键来阻拦组合键 。
vb屏蔽键盘上部分键分二步vb.net屏蔽组合键:
1、建立一个模块vb.net屏蔽组合键,然后复制下面代码
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
稍微进一步修改,vb.net屏蔽组合键你可以的吧……
屏蔽F4 和 WIN 就可以了
vb.net屏蔽组合键的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于vba屏蔽所有告警、vb.net屏蔽组合键的信息别忘了在本站进行查找喔 。
推荐阅读
- 小度电视关机长什么样子,小度关机电视图片
- b战直播手机怎么,手机直播怎么操作
- 剪影拍摄为什么黑屏,剪影拍摄为什么黑屏了
- 网络信息安全毕业设计题目推荐,网络信息安全毕业论文
- python数据分组函数 python 分组函数
- 鸿蒙系统4.0是最高的吗,鸿蒙系统的最低要求
- 像素养成对战类游戏,像素养成游戏推荐
- sqlserver数据库转化成mysql,如何把sqlserver中的数据变成mysql
- 匿名函数python 匿名函数python用处