| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1929 人关注过本帖
标题:请问怎样屏蔽alt+F4,ctrl+alt+del,alt+tab
只看楼主 加入收藏
me4405801
Rank: 2
等 级:论坛游民
帖 子:37
专家分:17
注 册:2006-8-31
结帖率:100%
收藏
 问题点数:0 回复次数:5 
请问怎样屏蔽alt+F4,ctrl+alt+del,alt+tab

请问怎样屏蔽alt+F4,ctrl+alt+del,alt+tab

我曾经这样屏蔽alt+F4
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

cancel=1
End Sub

但总感觉不是太彻底。

至于怎样屏蔽ctrl+alt+del,alt+tab我是根本不知道,请高手赐教!

搜索更多相关主题的帖子: 屏蔽alt tab del Integer Sub 
2006-09-01 16:15
yeshirow
Rank: 4
等 级:贵宾
威 望:10
帖 子:854
专家分:0
注 册:2006-6-8
收藏
得分:0 

屏蔽 這些是有很多方法的

Alt+F4 還可以通過 禁止 SystemMenu 的 SC_CLOSE 選項.

Ctrl+Alt+Del 可以用 open 語句打開 taskmgr.exe (這是在 XP sp2 下測試的, 其他的不知道)

網上有很多的資源, 可以搜索下.


原來朋友仔感情再天真, 亦是我永遠也會愛惜的人, 明日愛他人, 也記住學會不要緊; 原來朋友比戀人更高分, 亦讓我開始懂得不記恨, 若大家都敏感, 我更要永遠記得拒絕再因小事怪人, 爲何沒有這條校訓...Twins-朋友仔 MCSD Training
2006-09-01 18:00
me4405801
Rank: 2
等 级:论坛游民
帖 子:37
专家分:17
注 册:2006-8-31
收藏
得分:0 
二楼的朋友可以说具体点吗,怎样open mstask
2006-09-03 10:11
msxjc
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2005-3-28
收藏
得分:0 

对于没打过sp1和sp2补丁的xp系统,方法如下:
把以下代码放入vb的模块中:
Public 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 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, lParam 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 VK_F4 = vbKeyF4

Public Const WH_KEYBOARD_LL = 13
Public Const LLKHF_ALTDOWN = &H20

Public Type KBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type

Dim p As KBDLLHOOKSTRUCT


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)
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.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0)) Or _
((p.vkCode = 91) Or (p.vkCode = 92) Or (p.vkCode = 93)) Or _
((p.vkCode = VK_F4) And (p.flags And LLKHF_ALTDOWN) <> 0) '加入这行代码屏弊Alt+F4

End If
End If

If fEatKeystroke Then
LowLevelKeyboardProc = -1
Else
LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
End If
End Function
然后先在窗体的声明中加入:
Dim hhkLowLevelKybd As Long

在窗体的load事件中写上:
hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
在窗体的unload事件中写上:
If hhkLowLevelKybd <> 0 Then UnhookWindowsHookEx hhkLowLevelKybd

以上代码在没有打过sp1和sp2补丁的xp系统中,可以屏蔽掉xp中所有定义的系统热键(包括CTRL+ESC、ALT+TAB、ALT+F4、WIN键+任何键的组合、CTRL+ALT+DEL、等等)
对于打过sp1和sp2补丁的xp系统,以上代码不能屏蔽CTRL+ALT+DEL组合键。但是可以这样:
在窗体中的load事件中加入:
s = Environ("windir")
s = s + "\system32\taskmgr.exe"
Open s For Random Lock Read As #1
在窗体的unload事件中加入:
Close #1
就可以实现屏蔽CTRL+ALT+DEL组合键,再组合上面的代码,就可以屏蔽掉xp系统中所有已经定义的系统热键了。


2006-09-24 10:03
google
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:22
帖 子:3419
专家分:23
注 册:2005-11-1
收藏
得分:0 
SP2补丁的怎么搞?

祝天下所有母亲幸福安康!~
2006-09-24 19:08
msxjc
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2005-3-28
收藏
得分:0 

5楼的问题,在我的回复中不是已经写得很清楚了吗?


2006-09-24 20:21
快速回复:请问怎样屏蔽alt+F4,ctrl+alt+del,alt+tab
数据加载中...
 
   



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

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