Public Declare Function ClipCursor Lib "神烂陵user32" Alias "ClipCursor" (lpRect As Any) As Long lpRect是RECT区域游戚结构体。关历明于禁用Alt+Tab,比较复杂:Option ExplicitDim hhkLowLevelKybd As LongPrivate Sub chkDisable_Click()If chkDisable = vbChecked Then hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)Else UnhookWindowsHookEx hhkLowLevelKybd hhkLowLevelKybd = 0End IfEnd SubPrivate Sub Form_Unload(Cancel As Integer)If hhkLowLevelKybd <> 0 Then UnhookWindowsHookEx hhkLowLevelKybdEnd Subin new module named modDisableLowLevelKeys.bascode below:Option ExplicitPublic Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As IntegerPublic Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As LongPublic Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As LongPublic Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As LongPublic Const HC_ACTION = 0Public Const WM_KEYDOWN = &H100Public Const WM_KEYUP = &H101Public Const WM_SYSKEYDOWN = &H104Public Const WM_SYSKEYUP = &H105Public Const VK_TAB = &H9Public Const VK_CONTROL = &H11Public Const VK_ESCAPE = &H1BPublic Const WH_KEYBOARD_LL = 13Public Const LLKHF_ALTDOWN = &H20Public Type KBDLLHOOKSTRUCT vkCode As Long scanCode As Long flags As Long time As Long dwExtraInfo As LongEnd TypeDim p As KBDLLHOOKSTRUCTPublic 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) fEatKeystroke = _ ((p.vkCode = VK_TAB) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or _ ((p.vkCode = VK_ESCAPE) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or _ ((p.flags And LLKHF_ALTDOWN) <> 0) Or _ ((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0)) Or _ ((p.vkCode = 91) Or (p.vkCode = 92) Or (p.vkCode = 93)) 'TAB+ALT 'Esc+ALT 'Alt+Any(Alt+F4) 'Esc+Ctrl '左右Win 和徽标键 End If End If If fEatKeystroke Then LowLevelKeyboardProc = -1 Else LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam) End IfEnd Function
相关文章
-
湖北移动网上营业厅有什么
2023-03-29 15:27 阅读(553) -
移动空调好不好?到底适不适合买
2023-03-29 10:58 阅读(544) -
win7无法显示隐藏文件 无法找到脚本文件hidefile.vbs
2023-03-29 04:21 阅读(568)
1 2022中国移动不限量套餐怎么办理
584 阅读
2 移动空调好不好?到底适不适合买?
562 阅读
3 浙江移动手机网上营业厅
678 阅读
4 谁能告诉我TVB是什么,怎么能看TVB?最好解释清楚一点,
601 阅读
5 黑龙江移动网上营业厅如何查询套餐??
608 阅读