This documentation is archived and is not being maintained.

Mouse Class

Provides properties for getting information about the format and configuration of the mouse installed on the local computer.

Namespace:  Microsoft.VisualBasic.Devices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

[HostProtectionAttribute(SecurityAction::LinkDemand, Resources = HostProtectionResource::ExternalProcessMgmt)]
public ref class Mouse


The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Resources. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

For more detailed information, see the Visual Basic topic My.Computer.Mouse Object.

The My.Computer.Mouse object provides a way to find information about the computer's mouse: whether the mouse buttons are swapped, and details about the mouse wheel.

This example uses the My.Computer.Mouse.WheelExists and My.Computer.Mouse.WheelScrollLines properties to determine if the mouse has a scroll wheel and how much to scroll when it rotates.

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.")
        MsgBox("Application scrolls " & _
            (-lines) & " page(s) for each wheel turn.")
    End If 
    MsgBox("Mouse has no scroll wheel.")
End If


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0