您的位置:首页 > 编程语言 > VB

.net随笔-vb.net鼠标

2019-03-29 09:14 525 查看
版权声明:本博客所有文章版权归博主刘兴所有,转载请注意来源 https://blog.csdn.net/AI_LX/article/details/88876188
Imports System.Runtime.InteropServices

Public Class Form1

Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Auto Function FindWindowEx Lib "user32" (ByVal hWndParent As Integer, ByVal hWndChildAfter As Integer, ByVal lpszClass As String, ByVal lpszWindow As String) As Integer

Private Declare Auto Function SetForegroundWindow Lib "user32" (ByVal hWnd As Integer) As Integer
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA"(ByVal hWnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Private Const WM_SETTEXT As Integer = &HC
Private Const WM_COMMAND As Integer = &H111

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If My.Computer.Mouse.WheelExists Then
Dim lines As Integer = My.Computer.Mouse.WheelScrollLines
If lines > 0 Then
MsgBox("Application scrolls " &
lines & " line(s) for each wheel turn.")
Else
MsgBox("Application scrolls " &
(-lines) & " page(s) for each wheel turn.")
End If
Else
MsgBox("Mouse has no scroll wheel.")
End If

End Sub

End Class
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: