Il problema è che la SystemParametersInfo quando usata con SPI_SETMOUSESPEED si aspetta nel penultimo parametro un intero, mentre quando è usata con SPI_GETMOUSESPEED si aspetta un puntatore ad un intero. Puoi risolvere così:
A questo punto per leggere e scrivere l'impostazione in questione ti basterà usare la property SPI.MouseSpeed. Ti consiglio tuttavia di lasciare stare le impostazioni in questione: se l'utente vuole modificarle, lo farà da sé nel pannello di controllo.codice:Module SPI Private Declare Ansi Function SystemParametersInfoVal Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uiAction As Integer, ByVal uiParam As Integer, ByVal pvParam As Integer, ByVal WinIni As Integer) As Boolean Private Declare Ansi Function SystemParametersInfoRef Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uiAction As Integer, ByVal uiParam As Integer, ByRef pvParam As Integer, ByVal WinIni As Integer) As Boolean Private Const SPI_GETMOUSESPEED = &H70 Private Const SPI_SETMOUSESPEED = 113 Public Property MouseSpeed() As Integer Get Dim ret As Integer If Not SystemParametersInfoRef(SPI_GETMOUSESPEED, 0, ret, 0) Then Throw New System.ComponentModel.Win32Exception("SystemParametersInfo failed.") End If Return ret End Get Set (ByVal Value As Integer) If Not SystemParametersInfoVal(SPI_GETMOUSESPEED, 0, Value, 0) Then Throw New System.ComponentModel.Win32Exception("SystemParametersInfo failed.") End If End Set End Property End Module

Rispondi quotando