标题:CTRL+ALT+DEL的控制和修改
只看楼主
xiao173612
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2008-11-3
结帖率:100%
 问题点数:0 回复次数:1 
CTRL+ALT+DEL的控制和修改
问题描述:这是一个我网上找来的控制热键的例子,说是能控制CTRL+ALT+DEL、WIN、ALT+TAB等(其它有效,CTRL+ALT+DEL还是无法屏蔽,这也要屏蔽掉),现在要取消两个单选框,只剩下文本框和按钮,屏蔽热键要在打开这个程序时生效,(在Form_Load()时),不可限制字母键和数字键,在按取消键时屏蔽失效,请问怎么修改;
图片截图在附件;

[B]Module1.bas代码如下;[/B]
Option Explicit

Private Sub chkDisable_Click()

    If chkDisable = vbChecked Then
       hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0) '加载钩子

    Else

        UnhookWindowsHookEx hhkLowLevelKybd
        hhkLowLevelKybd = 0

    End If

End Sub

Private Sub chkDisableAll_Click()

    If chkDisableAll = vbChecked Then

        hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0) '加载钩子
        Text1.SetFocus

    Else

        UnhookWindowsHookEx hhkLowLevelKybd
        hhkLowLevelKybd = 0

    End If

End Sub

Private Sub Command1_Click()

    Unload Me

End Sub

Private Sub Form_Unload(Cancel As Integer)

    If hhkLowLevelKybd <> 0 Then UnhookWindowsHookEx hhkLowLevelKybd  '卸载钩子

End Sub


[B]Form1代码如下;[/B]

Option Explicit

Private Sub chkDisable_Click()

    If chkDisable = vbChecked Then
       hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0) '加载钩子

    Else

        UnhookWindowsHookEx hhkLowLevelKybd
        hhkLowLevelKybd = 0

    End If

End Sub

Private Sub chkDisableAll_Click()

    If chkDisableAll = vbChecked Then

        hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0) '加载钩子
        Text1.SetFocus

    Else

        UnhookWindowsHookEx hhkLowLevelKybd
        hhkLowLevelKybd = 0

    End If

End Sub

Private Sub Command1_Click()

    Unload Me

End Sub

Private Sub Form_Unload(Cancel As Integer)

    If hhkLowLevelKybd <> 0 Then UnhookWindowsHookEx hhkLowLevelKybd  '卸载钩子

End Sub

有会修改的高手请帮忙

未命名.JPG (30.14 KB)
搜索更多相关主题的帖子: DEL CTRL ALT 
2008-11-05 10:40
Joforn
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1242
专家分:122
注 册:2007-1-2
得分:0 
只见过VB+汇编的真正实现了钩住Ctrl+Alt+Del,纯VB的我暂时还没见过源码。

VB QQ群:47715789
2008-11-05 21:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-242509-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.100868 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved