vb 松开鼠标事件
的有关信息介绍如下:'模块代码 'BY:QQ:1633602558Option ExplicitPrivate Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As LongPrivate Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As LongPrivate Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Const HC_ACTION = 0Private Const WH_MOUSE = 7 '本地钩子Private Const WH_MOUSE_LL = 14 '全局钩子'鼠标消息Private Const WM_MOUSEMOVE = &H200 '移动鼠标Private Const WM_LBUTTONDOWN = &H201 '按下鼠标左键Private Const WM_LBUTTONUP = &H202 '释放鼠标左键Private Const WM_LBUTTONDBLCLK = &H203 '双击鼠标左键Private Const WM_RBUTTONDOWN = &H204 '按下鼠标右键Private Const WM_RBUTTONUP = &H205 '释放鼠标右键Private Const WM_RBUTTONDBLCLK = &H206 '双击鼠标右键Private Const WM_MBUTTONDOWN = &H207 '按下鼠标中键Private Const WM_MBUTTONUP = &H208 '释放鼠标中键Private Const WM_MBUTTONDBLCLK = &H209 '双击鼠标中键Private Const WM_MOUSEACTIVATE = &H21 '当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给当前窗口Private Const WM_MOUSEFIRST = &H200 '鼠标移动时发生(与WM_MOUSEMOVE等值),常用于判断鼠标消息的范围Private Const WM_MOUSELAST = &H209 'WM_MBUTTONDBLCLK的别名,通常用于判断鼠标消息的范围Private Const WM_MOUSEWHEEL = &H20A '当鼠标轮子转动时发送此消息个当前有焦点的控件Private hHook As LongPublic Function HookProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As LongIf nCode = HC_ACTION ThenSelect Case wParamCase WM_MOUSEMOVE '移动鼠标Case WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK '按下鼠标左键/释放鼠标左键/双击鼠标左键Case WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK '按下鼠标右键/释放鼠标右键 /双击鼠标右键HookProc = 1: Exit Function '示例:吃掉鼠标右键消息Case WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK '按下鼠标中键'释放鼠标中键'双击鼠标中键Case WM_MOUSEACTIVATE '当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给当前窗口Case WM_MOUSEFIRST '鼠标移动时发生(与WM_MOUSEMOVE等值),常用于判断鼠标消息的范围Case WM_MOUSELAST 'WM_MBUTTONDBLCLK的别名,通常用于判断鼠标消息的范围Case WM_MOUSEWHEEL '当鼠标轮子转动时发送此消息个当前有焦点的控件Case Else:End SelectEnd IfHookProc = CallNextHookEx(hHook, nCode, wParam, lParam)End FunctionPublic Sub SetMouseHook(Optional ByVal sTest As Boolean) '设置鼠标按键钩子If hHook <> 0 Then Call UnhookWindowsHookEx(hHook)If sTest = True ThenhHook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf HookProc, App.hInstance, 0) '全局勾子ElsehHook = SetWindowsHookEx(WH_MOUSE, AddressOf HookProc, 0, App.ThreadID) '本地勾子End IfEnd SubPublic Sub DelMouseHook() '卸载鼠标按键钩子If hHook <> 0 ThenCall UnhookWindowsHookEx(hHook)hHook = 0End IfEnd Sub'窗体代码'Private Sub Form_Load()' Call SetMouseHook(True) '设置鼠标钩子【全局=True,线程=False】'End Sub'Private Sub Form_Unload(Cancel As Integer)' Call DelMouseHook '卸载鼠标按键钩子'End Sub'祥细代码发你了,如果还有不懂,可加我QQ问,最近写过类似程序,正好用到这个