Oh, and it also turns off Mouse Trails, and Snap to Default Button.

Dax

*********** REPLY SEPARATOR  ***********

On 4/19/2002 at 11:57 AM Dax T. Games wrote:

>Darin,
>
>
>Here's the Perl code, this is what I use and it works very well.
>
>Dax,
>
>use Win32::API;
>
>#
># Import Win32 functions
>#
>$SystemParametersInfo = new Win32::API("User32", "SystemParametersInfo",
>[I, I, P, I], N) || die;
>
>#
># Valid Values for $GS_MouseSpeed:  0, 1, 2, 3
>#
>SetMouseSpeed($GS_MouseSpeed);
>
>sub SetMouseSpeed {
>       my $LS_MouseSpeed = shift;
>
>       if (defined Win32) {
>               use constant SPI_GETMOUSE => 3;
>               use constant SPI_SETMOUSE => 4;
>               use constant SPI_GETMOUSESPEED => 112;
>               use constant SPI_SETMOUSESPEED => 113;
>               use constant SPI_GETSNAPTODEFBUTTON=> 95;
>               use constant SPI_SETSNAPTODEFBUTTON=> 96;
>               use constant SPI_GETMOUSETRAILS => 94;
>               use constant SPI_SETMOUSETRAILS => 93;
>               use constant SPIF_SENDCHANGE => 0x0002;
>               use constant SPIF_UPDATEINIFILE => 0x001;
>               #use constant NULL => 0x00;
>
>               if ($Registry->{"HKEY_CURRENT_USER/Control
>Panel/Mouse//MouseSensitivity"}) {
>                       $mArray = pack(L, '');
>
>                       my $result = $SystemParametersInfo->Call(SPI_GETMOUSESPEED, 
>0x00,
>$mArray, 0x00);
>                       my $LS_A = unpack(I,$mArray);
>
>                       $mArray = pack(L, 10);
>                       my $next_result = 
>$SystemParametersInfo->Call(SPI_SETMOUSESPEED, 0x00,
>$mArray, SPIF_SENDCHANGE);
>
>                       my $result = $SystemParametersInfo->Call(SPI_GETMOUSESPEED, 
>0x00,
>$mArray, 0x00);
>
>                       my $LS_A = unpack(L,$mArray);
>               }
>
>               if (defined $Registry->{"HKEY_CURRENT_USER/Control
>Panel/Mouse//SnapToDefaultButton"}) {
>                       $mArray = pack(I, '');
>
>                       my $result = 
>$SystemParametersInfo->Call(SPI_GETSNAPTODEFBUTTON, 0x00,
>$mArray, 0x00);
>                       my $LS_A = unpack(I,$mArray);
>
>                       $mArray = pack(L, 0);
>                       my $next_result = 
>$SystemParametersInfo->Call(SPI_SETSNAPTODEFBUTTON,
>$mArray , 0x00, SPIF_SENDCHANGE);
>
>                       my $result = 
>$SystemParametersInfo->Call(SPI_GETSNAPTODEFBUTTON, 0x00,
>$mArray, 0x00);
>
>                       my $LS_A = unpack(L,$mArray);
>               }
>
>               if (defined $Registry->{"HKEY_CURRENT_USER/Control
>Panel/Mouse//MouseTrails"}) {
>                       $mArray = pack(L, '');
>
>                       my $result = $SystemParametersInfo->Call(SPI_GETMOUSETRAILS, 
>0x00,
>$mArray, 0x00);
>                       my $LS_A = unpack(I,$mArray);
>
>                       $mArray = pack(L, 0);
>                       my $next_result = 
>$SystemParametersInfo->Call(SPI_SETMOUSETRAILS,
>$mArray , 0x00, SPIF_SENDCHANGE);
>
>                       my $result = $SystemParametersInfo->Call(SPI_GETMOUSETRAILS, 
>0x00,
>$mArray, 0x00);
>
>                       my $LS_A = unpack('L',$mArray);
>               }
>
>               $mArray = pack('L3', '', '', '');
>
>               my $result = $SystemParametersInfo->Call(SPI_GETMOUSE, 0x00, $mArray,
>0x00);
>               my ($LS_A,$LS_B,$LS_C) = unpack('L3',$mArray);
>
>               if ($LS_MouseSpeed == 0) {
>                       $mArray = pack('L3', 0, 0, 0);
>               }
>               elsif ($LS_MouseSpeed == 1) {
>                       $mArray = pack('L3', 7, 0, 1);
>               }
>               elsif ($LS_MouseSpeed == 2) {
>                       $mArray = pack('L3', 4, 12, 2);
>               }
>               elsif ($LS_MouseSpeed == 3) {
>                       $mArray = pack('L3', 4, 6, 2);
>               }
>
>               my $next_result = $SystemParametersInfo->Call(SPI_SETMOUSE, 0x00,
>$mArray, SPIF_SENDCHANGE);
>               my $result = $SystemParametersInfo->Call(SPI_GETMOUSE, 0x00, $mArray,
>0x00);
>
>               my ($LS_A,$LS_B,$LS_C) = unpack('L3',$mArray);
>       }
>}
>
>
>*********** REPLY SEPARATOR  ***********
>
>On 4/19/2002 at 12:35 PM [EMAIL PROTECTED] wrote:
>
>>I do not know Perl, I just read the list trying to pick it up.
>>I know that when you are on the mouse property sheet you must hit apply in
>>order for your changes to take affect.
>>
>>From what I have read it looks like you need to set the value, then Query
>>the value.
>>This will make the driver query the registry without reload the local user
>>registry.
>>
>>These new SPI_XXX values let you programmatically retrieve and set system
>>options such the mouse speed, whether the active window "tracks" the
>>cursor,
>>and if menus are animated (that is, they slide open, rather than pop up).
>>Where available, Figure 7 includes a short description of what the SPI_XXX
>>values do. In most other cases, the name itself is usually enough of an
>>indicator. To let you easily see what all the new SPI_XXX and SM_XXX
>values
>>return, I wrote the SystemMetricsParams program listed in Figure 8.
>>
>>From
>>http://www.microsoft.com/msj/defaultframe.asp?page=/msj/1197/nt5dll.htm&nav=
>>/msj/1197/newnav.htm
>>
>>
>>Under Windows 98 and 2000 you can control the speed of the mouse. The
>mouse
>>speed determines how far the pointer will move based on the distance the
>>mouse moves. The pvParam parameter must point to an integer that receives
>a
>>value which ranges between 1 (slowest) and 20 (fastest). A value of 10 is
>>the default. The value can be set by an end user using the mouse control
>>panel application or by an application using the SystemParameterInfo API
>>function:
>>
>>Private Declare Function SystemParametersInfo Lib "user32" Alias _
>>    "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
>_
>>    ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
>>Const SPI_SETMOUSESPEED = 113
>>Const SPI_GETMOUSESPEED = 112
>>
>>' modify the mouse speed to make it as fast as possible
>>Dim Speed As Long
>>Speed = 20
>>SystemParametersInfo SPI_SETMOUSESPEED, 0, ByVal Speed, 0
>>
>>You can retrieve the current mouse speed (so that you can later restore
>it)
>>using the SPI_GETMOUSESPEED value for the first argument to
>>SystemParameterInfo:
>>Dim Speed As Long
>>' note that Speed is passed ByRef
>>SystemParametersInfo SPI_SETMOUSESPEED, 0, Speed, 0
>>Print "Mouse speed = " & Speed
>>
>>From http://www.vb2themax.com/Item.asp?PageID=TipBank&Cat=1450&ID=338
>>
>>
>>-----Original Message-----
>>From: Cruickshanks, Darin [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, April 17, 2002 8:57 AM
>>To: [EMAIL PROTECTED]
>>Subject: How to programmatically make registry changes take effect
>>
>>
>>Hi All,
>>Does anyone know of a way to make changes to the registry (in particular
>>HKCU) take effect immediately using Perl?  For instance if you change the
>>mouse speed by modifying the appropriate keys in HKCU using Perl, the
>>changes only take effect after you logoff then back on.  A third party
>>utility that performed this function would be just as useful,
>>Thanks,
>>Darin
>>--------------------------------------------
>>Darin Cruickshanks
>>Labs Manager, Computing Service
>>University of Essex
>>[EMAIL PROTECTED]
>>01206 873585
>>_______________________________________________
>>Perl-Win32-Admin mailing list
>>[EMAIL PROTECTED]
>>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
>
>_______________________________________________
>Perl-Win32-Admin mailing list
>[EMAIL PROTECTED]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to