Source: Internet
Author: User
Refer to some foreign websites, forum code, get the following synthesis, the above environment test through, copyright belongs to the original author.
Add a checkbox named chkdisable.caption= "&disable Alt-tab, Alt-esc, Ctrl-esc,lwin,rwin,win+any"
To a new from named Frmmain.frm in new project Hook_kb_ll.vbp
Add code below:
Option Explicit
Private Sub Chkdisable_click ()
If chkdisable = vbchecked Then
HHKLOWLEVELKYBD = SetWindowsHookEx (Wh_keyboard_ll, AddressOf LowLevelKeyboardProc, app.hinstance, 0)
End If
End Sub
Private Sub form_unload (Cancel as Integer)
If hhklowlevelkybd <> 0 Then UnhookWindowsHookEx hhklowlevelkybd
End Sub
In new module named Moddisablelowlevelkeys.bas
Code below:
Option Explicit
Public Declare Sub copymemory Lib "kernel32" Alias "RtlMoveMemory" (destination as all, Source as any, ByVal Length as Lon G
Public 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 CallNextHookEx Lib "user32" (ByVal hhook as Long, ByVal ncode as Long, ByVal WParam as Long, Lpara M as any) as Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal Hhook as long) as long
Public Const hc_action = 0
Public Const Wm_keydown = &h100
Public Const Wm_keyup = &h101
Public Const Wm_syskeydown = &h104
Public Const Wm_syskeyup = &h105
Public Const Vk_tab = &h9
Public Const Vk_control = &h11
Public Const Vk_escape = &h1b
Public Const Wh_keyboard_ll = 13
Public Const Llkhf_altdown = &h20
Public Type Kbdllhookstruct
Vkcode as Long

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.