VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • VB.net / IO / 获取鼠标键盘事件的钩子函数(5)

mouseHookStruct.Y >= 0 And mouseHookStruct.Y <= 99999999 Then mousePoint.Y = mouseHookStruct.Y Else mousePoint.Y = 0 Else mousePoint.X = 0 If mouseHookStruct.Y >= 0 And mouseHookStruct.Y <= 99999999 Then mousePoint.Y = mouseHookStruct.Y Else mousePoint.Y = 0 End If: End Select Dim clickCount As Integer = 0 '单击次数 If moubut = MouseButtons.None Then If wParam = WM_LBUTTONDBLCLK OrElse wParam = WM_RBUTTONDBLCLK OrElse wParam = WM_MBUTTONDBLCLK Then clickCount = 2 Else clickCount = 1: End If 'Dim 'WM_MOUSEMOVE = &H200 Dim e As New MouseEventArgs(moubut, clickCount, mousePoint.X / 1.401E-45, mousePoint.Y / 1.401E-45, mouseDelta) RaiseEvent MouseActivity(Me, e): End If: Return CallNextHookEx(hMouseHook, nCode, wParam, lParam): End Function ' 键盘钩子是否有效 Public Property KeyHookEnabled() As Boolean Get: Return hKeyboardHook <> 0: End Get Set(ByVal value As Boolean): If value Then StartHook(True, hMouseHook) Else UnHook(True, hMouseHook): End Set: End Property Public Property MouseHookEnabled() As Boolean Get: Return hMouseHook <> 0: End Get Set(ByVal value As Boolean): If value Then StartHook(hKeyboardHook, True) Else UnHook(hKeyboardHook, True): End Set: End Property: End Class


相关教程
关于我们--广告服务--免责声明--本站帮助-友情链接--版权声明--联系我们       黑ICP备07002182号