VB6.0如何完全禁用或者屏蔽鼠标滚轮的任何输入 5
VB6.0如何完全禁用或者屏蔽鼠标滚轮的任何输入?我想实现的功能是打开VB软件后,鼠标滚轮没有任何输入信号,相当于失效,请问哪位大神能帮帮我?不想让鼠标滚动时有信号,因为...
VB6.0如何完全禁用或者屏蔽鼠标滚轮的任何输入?
我想实现的功能是 打开VB软件后,鼠标滚轮没有任何输入信号,相当于失效,请问哪位大神能帮帮我?
不想让鼠标滚动时有信号,因为由于加载了skinH皮肤,鼠标在datagrid上滚动时就出错自动退出 展开
我想实现的功能是 打开VB软件后,鼠标滚轮没有任何输入信号,相当于失效,请问哪位大神能帮帮我?
不想让鼠标滚动时有信号,因为由于加载了skinH皮肤,鼠标在datagrid上滚动时就出错自动退出 展开
1个回答
展开全部
'==================窗体代码=================
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
hHook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseHookProc, App.hInstance, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx hHook
End Sub
'=============模块代码==================
Public Const WH_MOUSE = 7 '本地钩子
Public Const WH_MOUSE_LL = 14 '全局钩子
Public Const GWL_WNDPROC = (-4)
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 WM_LBUTTONDOWN = &H201 '窗口中按下鼠标左键
'Public Const WM_LBUTTONUP = &H202 '窗口中松开鼠标左键
'Public Const WM_MOUSEMOVE = &H200 '窗口中移动鼠标
'Public Const WM_RBUTTONDOWN = &H204 '窗口中按下鼠标右键
'Public Const WM_RBUTTONUP = &H205 '窗口中松开鼠标右键
Public Const WM_MOUSEWHEEL = &H20A '鼠标滚轮
'Public Const WM_NCLBUTTONDOWN = &HA1 '窗口标题栏中按下鼠标左键
'Public Const WM_NCLBUTTONUP = &HA2 '窗口标题栏中左开鼠标左键
'Public Const WM_NCMOUSEMOVE = &HA0 '窗口标题栏中移动鼠标
'Public Const WM_NCRBUTTONDOWN = &HA4 '窗口标题栏中按下鼠标右键
'Public Const WM_NCRBUTTONUP = &HA5 '窗口标题栏中松开鼠标右键
Public hHook As Long
Public Function MouseHookProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case wParam
' Case WM_LBUTTONDOWN, WM_NCLBUTTONDOWN
' Debug.Print "左键按下"
' Case WM_LBUTTONUP, WM_NCLBUTTONUP
' Debug.Print "左键弹起"
' Case WM_RBUTTONDOWN, WM_NCRBUTTONDOWN
' Debug.Print "右键按下"
' Case WM_RBUTTONUP, WM_NCRBUTTONUP
' Debug.Print "右键弹起"
' Case WM_MOUSEMOVE, WM_NCMOUSEMOVE
' Debug.Print "鼠标移动"
Case WM_MOUSEWHEEL
Debug.Print "鼠标滚轮"
MouseHookProc = 1
Exit Function
End Select
MouseHookProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询