.net随笔-vb2015鼠标

版权声明:本博客所有文章版权归博主刘兴所有,转载请注意来源 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

猜你喜欢

转载自blog.csdn.net/AI_LX/article/details/88876188