VB热键屏蔽
发布网友
发布时间:2023-08-16 22:43
我来回答
共3个回答
热心网友
时间:2023-09-04 07:59
任务管理器中找HOTKEY进程,关闭就可以了。但是救护中心的热键就不起作用了,你再用的时候再双击救护中心的图标就可以了。
这个进程是随救护中心加载的,需要你每次都这样操作。如果游戏的热键可以改,是最方便的。
方正电脑安装方正电脑救护中心后出现的界面。向不用这个的话只有将硬盘的隐藏分区释放删除就可以了!
不过那样的话你的这个功能也就无法再用了.
如果用好了后这个对你的电脑的系统维护是很有帮助的。建议保留!
热心网友
时间:2023-09-04 07:59
'窗体置顶简单,屏蔽热键有点难度,给你找找资料
Option
Explicit
Private
Declare
Function
SetWindowPos
Lib
"user32"
(ByVal
hWnd
As
Long,
ByVal
hWndInsertAfter
As
Long,
ByVal
X
As
Long,
ByVal
Y
As
Long,
ByVal
cx
As
Long,
ByVal
cy
As
Long,
ByVal
wFlags
As
Long)
As
Long
Private
Sub
Check1_Click()
If
Check1
=
1
Then
SetWindowPos
Me.hWnd,
-1,
Me.Left
/
Screen.TwipsPerPixelX,
_
Me.Top
\
Screen.TwipsPerPixelY,
Me.Width
\
Screen.TwipsPerPixelX,
_
Form1.Height
\
Screen.TwipsPerPixelY,
0
Else
SetWindowPos
Me.hWnd,
-2,
Me.Left
/
Screen.TwipsPerPixelX,
_
Me.Top
\
Screen.TwipsPerPixelY,
Me.Width
\
Screen.TwipsPerPixelX,
_
Form1.Height
\
Screen.TwipsPerPixelY,
0
End
If
End
Sub
Private
Sub
Form_Activate()
With
Check1
.Caption
=
"总在最前面"
.Value
=
1
End
With
End
Sub
热心网友
时间:2023-09-04 07:59
这个是完美屏蔽。
模块
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 Const VK_LMENU = &HA4
Public Const VK_ESCAPE = &H1B
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
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 VK_ESCAPE
If (GetKeyState(VK_LMENU) And &H8000) <> 0 Then '如果按了esc+alt键
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
窗体
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
我给你做的!
大哥,你那API函数是注册热键用的啊!你就用我这个代码可以屏蔽除了Ctrl+alt+del之外的任何组合按键的。