Download
Info
Windows Default Integer Speed 1-10
With the Tool = Mouse Set Integer Speed 1-20
Visual Studio Source Code
Quote:
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Imports System.IO
Imports System.Runtime.Remoting
Imports System.Management
Imports System.Threading
Imports Microsoft.Win32
Imports Microsoft.VisualBasic.ApplicationServices
Imports System.Windows.Forms.VisualStyles.VisualStyleEleme nt
Public Class MConfig
' Deklariere die Windows API-Funktion SystemParametersInfo
<DllImport("user32.dll")>
Private Shared Function SystemParametersInfo(uAction As UInteger, uParam As UInteger, lpvParam As UInteger, fuWinIni As UInteger) As Boolean
End Function
' Deklariere die Windows API-Funktion GetAsyncKeyState
<DllImport("user32.dll")>
Private Shared Function GetAsyncKeyState(vKey As Integer) As Short
End Function
Private Const SPI_GETMOUSE As UInteger = &H3A
' Konstanten für die API-Funktionen
Private Const SPI_SETMOUSEBUTTONSWAP As UInteger = &H21
Private Const SPIF_UPDATEINIFILE As UInteger = &H1
Private Const SPIF_SENDCHANGE As UInteger = &H2
Private Const VK_LBUTTON As Integer = &H1
Private Const VK_RBUTTON As Integer = &H2
Private Declare Function SystemParametersInfos Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Int32, ByVal uParam As Int32, ByVal lpvParam As Int32, ByVal fuWinIni As Int32) As Int32
Public Const SPI_GETMOUSESPEED As Long = 112
Public Const SPI_SETMOUSESPEED As Int32 = 113
Public Const SPIF_SENDWININICHANGE As Long = &H2
Public Function MausSpeedschreiben()
If LoadingBool = False Then
SystemParametersInfos(SPI_SETMOUSESPEED, 0, Integer.Parse(CursorSpeedBar.Value), 0)
Speedlabel.Text = CursorSpeedBar.Value.ToString
ElseIf LoadingBool = True Then
SystemParametersInfos(SPI_SETMOUSESPEED, 0, Integer.Parse(CursorSpeedBar.Value), 0)
Speedlabel.Text = CursorSpeedBar.Value.ToString
My.Settings.MausGeschwindigkeit = CursorSpeedBar.Value.ToString
My.Settings.Save()
End If
'MessageBox.Show("Cursor Speed set to " & CursorSpeedBar.Value.ToString())
LoadingBool = True
Return Nothing
End Function
' Minimier-Event Konstanten
#Region "Konstanten"
Const WM_SYSCOMMAND As Int32 = &H112
Const SC_MINIMIZE As Int32 = &HF020
#End Region
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = WM_SYSCOMMAND Then
If m.WParam.ToInt32 = SC_MINIMIZE Then
RaiseEvent Minimize(New EventArgs())
End If
End If
End Sub
Public Event Minimize(ByVal e As EventArgs)
Private Sub Me_Minimize(ByVal e As EventArgs) Handles Me.Minimize
Me.WindowState = FormWindowState.Minimized
Me.ShowInTaskbar = False
Me.Hide()
End Sub
Private Sub MConfig_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PrimärTastenBox.Items.Add("Left")
PrimärTastenBox.Items.Add("Right")
PrimärTastenBox.SelectedIndex = 0 ' Standardmäßig auf "Left" setzen
CursorSpeedBar.Value = My.Settings.MausGeschwindigkeit
PrimärTastenBox.Text = My.Settings.MausPrimärTaste
ShowPointerSpeed()
End Sub
Public Sub ShowPointerSpeed()
speed = GetPointerSpeed()
CursorSpeedBar.Value = speed.ToString()
End Sub
Dim speed As Integer = 0
Public Function GetPointerSpeed() As Integer
Try
Dim registryKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Control Panel\Mouse")
If registryKey IsNot Nothing Then
Dim speedValue As Object = registryKey.GetValue("MouseSpeed")
If speedValue IsNot Nothing Then
Integer.TryParse(speedValue.ToString(), speed)
End If
registryKey.Close()
End If
Catch ex As Exception
MessageBox.Show("Error reading pointer speed from registry: " & ex.Message)
End Try
Return speed
End Function
'Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
' ' Überprüfe, ob die linke Maustaste gedrückt ist
' If GetAsyncKeyState(VK_LBUTTON) < 0 Then
' Me.Text = "Left Pressed"
' ElseIf GetAsyncKeyState(VK_RBUTTON) < 0 Then
' Me.Text = "Right Pressed"
' Else
' Me.Text = "hm"
' End If
'End Sub
Dim LoadingBool As Boolean = False
Private Sub PrimärTastenBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles PrimärTastenBox.SelectedIndexChanged
Dim swap As UInteger = If(PrimärTastenBox.SelectedItem.ToString() = "Right", 1, 0)
SystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, swap, 0, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
If LoadingBool = True Then
MessageBox.Show("Select primary to " & PrimärTastenBox.SelectedItem.ToString())
My.Settings.MausPrimärTaste = PrimärTastenBox.SelectedItem.ToString
My.Settings.Save()
End If
LoadingBool = True
End Sub
Private Sub CursorSpeedBar_Scroll(sender As Object, e As EventArgs) Handles CursorSpeedBar.Scroll
Thread.Sleep(10)
MausSpeedschreiben()
End Sub
Private Sub NotifyIcon1_MouseClick(sender As Object, e As MouseEventArgs) Handles NotifyIcon1.MouseClick
If e.Button = MouseButtons.Left Then
Me.WindowState = FormWindowState.Normal
Me.ShowInTaskbar = True
Me.Show()
End If
End Sub
End Class