Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

SPI_SETWHEELSCROLLCHARS



  • Please log in to reply
4 replies to this topic
Luca
  • Members
  • 11 posts
  • Last active: Nov 13 2015 08:45 PM
  • Joined: 08 Sep 2015

Hello, everyone, could you please give a little push to my script to switch it on? ... I did not mean too much of Autohotkey ...

With my little script attached (I simplified to be more clear in my description of the problem), I would be able to read and edit 4 mouse parameters , normally accessible from the panel setting of Windows.

I found two problems :

  1.  Write parameter mouse SwapMouseButtons.

Using Dllcall, the change is immediately transposed to windows, but strangely,  the registry key while working properly, reports a wrong value.

However I solved also adding ReWrite.

  1. True problem: I can not change the parameter "horizontal scroll wheel" of mouse (SETWHEELSCROLLCHARS).

Someone please help me solve?

Thank you.

;	Windows vers.7 

;----------------------------------------------------------------------------------
;	READ PARAMETERS from windows Registry





;	read parameter mouse SwapMouseButtons-----> VAR1
RegRead, VAR1, HKEY_CURRENT_USER, Control Panel\Mouse, SwapMouseButtons


;	read parameter mouse "vertical scroll wheel"-----> VAR2
;	SPI_GETWHEELSCROLLLINES 0x68
DllCall("SystemParametersInfo", UInt, 0x68, UInt, 0, UIntP, VAR2, UInt, 0) 


;	read parameter mouse "horizontal scroll wheel"-----> VAR3
RegRead, VAR3, HKEY_CURRENT_USER, Control Panel\Desktop, WheelScrollChars


;	read parameter mouse "Sensitivity"-----> VAR4
;	SPI_GETMOUSESPEED 0x70
DllCall("SystemParametersInfo", UInt, 0x70, UInt, 0, UIntP, VAR4, UInt, 0) 


msgbox swap=%VAR1% V-wheel=%VAR2% H-wheel=%VAR3% Sensitivity=%VAR4%



;----------------------------------------------------------------------------------
;	WRITE PARAMETERS to windows Registry




;**************************************************************************************
;	write parameter mouse SwapMouseButtons-----> VAR1
;	SPI_SETMOUSEBUTTONSWAP 0x21

VAR1=0
DllCall("SystemParametersInfo", UInt, 0x21, UInt, VAR1, UInt, 0, UInt, 0)

;	Use also RegWrite because DllCall immediately makes effect, but strangely does not update the registry

RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Mouse, SwapMouseButtons, %VAR1%
;**************************************************************************************



;	write parameter mouse "vertical scroll wheel"-----> VAR2
;	SPI_SETWHEELSCROLLLINES 0x69

VAR2=6
DllCall("SystemParametersInfo", UInt, 0x69, UInt, VAR2, UInt, 0, UInt, 0)


;**************************************************************************************

;	DOES NOT WORK:

;	write parameter mouse "horizontal scroll wheel"-----> VAR3
;	SPI_SETWHEELSCROLLCHARS 0x6D

VAR3=5
DllCall("SystemParametersInfo", UInt, 0x6D, UInt, VAR3, UInt, 0, UInt, 0)

;**************************************************************************************


;	write parameter mouse "Sensitivity"-----> VAR4
;	SPI_SETMOUSESPEED 0x71

VAR4=20
DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, VAR4, UInt, 0)







Flipeador
  • Members
  • 67 posts
  • Last active: Dec 29 2015 11:22 AM
  • Joined: 12 May 2014
✓  Best Answer
MsgBox % "MouseSpeed: " MouseSpeed()
	. "`nMouseScrollLines: " MouseScrollLines()
	. "`nMouseDoubleClick: " MouseDoubleClick()
	. "`nMouseWheelScrollChars: " MouseWheelScrollChars()
	
MouseSpeed(Value := "") {
    if (Value!="")
        return DllCall("User32.dll\SystemParametersInfoW", "UInt", 0x71, "UInt", 0, "UInt", (Value>20)?20:(Value<1)?1:Value, "UInt", 0x0001|0x0002)
    DllCall("User32.dll\SystemParametersInfoW", "UInt", 0x70, "UInt", 0, "UIntP", Value, "UInt", 0)
    return Value
}

MouseScrollLines(Lines := -1) {
    if (Lines >= 0)
        return DllCall("User32.dll\SystemParametersInfo", "UInt", 0x0069, "UInt", Lines, "UInt", 0, "UInt", 0x0001|0x0002)
    DllCall("User32.dll\SystemParametersInfo", "UInt", 0x0068, "UInt", 0, "UIntP", Lines, "UInt", 0)
    return Lines
}

MouseDoubleClick(ms := -1) {
    if (ms >= 0)
        return DllCall("User32.dll\SetDoubleClickTime", "UInt", ms)
    return DllCall("User32.dll\GetDoubleClickTime")
}

MouseSwap(fSwap := false) {
    return DllCall("User32.dll\SwapMouseButton", "Int", fSwap)
}

MouseWheelScrollChars(Value := "") {
    if (Value!="")
        return DllCall("User32.dll\SystemParametersInfo", "UInt", 0x006D, "UInt", Value, "UIntP", 0, "UInt", 0x0001|0x0002)
    DllCall("User32.dll\SystemParametersInfo", "UInt", 0x006C, "UInt", 0, "UIntP", Value, "UInt", 0)
    return  Value
}

Update*

MsgBox % MouseTrails(5)
MouseTrails(0)
MouseTrails(N := "") {
    if (N != "")
        return DllCall("User32.dll\SystemParametersInfoW", "UInt", 0x005D, "UInt", N, "Str", 0, "UInt", 0x0001|0x0002)
    DllCall("User32.dll\SystemParametersInfoW", "UInt", 0x005E, "UInt", 0, "UIntP", N, "UInt", 0)
    return N
}


Luca
  • Members
  • 11 posts
  • Last active: Nov 13 2015 08:45 PM
  • Joined: 08 Sep 2015

Thanks to the fast response Flipeador…

I tried your script (I state that I do not mean), and it WRITES CORRECTLY ALL parameters (except "fswap" I do not know where to set the value of my variable, sorry).

But when run the second time the script, read bad  values, but the values are correct, just as written before….strange! I something wrong in introducing my values?

Example:

 ……..

MouseSpeed(Vel :="19") {

………

MouseScrollLines(Lines := "9") {

……….

?? How can I enter a value?

MouseSwap(fSwap) {

??

……..

MouseWheelScrollChars(Value := "11") {

………

 

Please help, thanks

Bye



Flipeador
  • Members
  • 67 posts
  • Last active: Dec 29 2015 11:22 AM
  • Joined: 12 May 2014
But when run the second time the script, read bad  values...

what do you mean?

Note: I edited the code above

 

Example:

MouseSpeed(1) ;set
MsgBox % "MouseSpeed: " MouseSpeed() ;get
MouseSpeed(10)  ;restore default

MouseScrollLines(8) ;set
MsgBox % "MouseScrollLines: " MouseScrollLines() ;get
MouseScrollLines(4) ;restore default

MouseDoubleClick(2000) ;set
MsgBox % "MouseDoubleClick: " MouseDoubleClick() ;get
MouseDoubleClick(500)  ;restore default

MouseSwap(true) ;set
MsgBox
MouseSwap(false)  ;restore default


MouseWheelScrollChars(6) ;set
MsgBox % "MouseWheelScrollChars: " MouseWheelScrollChars() ;get
MouseWheelScrollChars(3) ;restore default

update*

to set a value: MouseSpeed(1)

to retrieve a value: SomeVar := MouseSpeed()

no need to assign a variable to pass a value to the function: MouseSpeed(SomeVar := 1) X



Luca
  • Members
  • 11 posts
  • Last active: Nov 13 2015 08:45 PM
  • Joined: 08 Sep 2015

Thank you very much Flipeador !

... thanks to your second communication I understand how I introduce variables in your script.

I tried it, it works perfectly.
Thank you.