While the wheel is moving in one direction, it is not expected to move in the opposite direction. This application detects such situations and tries to correct them in the right direction or ignores wrong entries. According to user preference.
It may not always work very well. If there is feedback, I try to improve.
I think of adding other mouse keys besides the wheel. Those with broken mouse keys write to me.
Do not be upset about throwing your broken rats. Wait for the mouse in your hand to fail.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 200
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
Gui +hWndhMainWnd -MaximizeBox +AlwaysOnTop -DPIScale
;####################### Start ##########################
RegRead , CheckStatus, HKEY_CURRENT_USER\SOFTWARE\WheelFixer , ShowTryIcon
if(CheckStatus != "Check" || CheckStatus != "UnCheck")
CheckStatus := "Check"
if(CheckStatus != "Check")
Menu, Tray, NoIcon
;####################### STart ##########################
;####################### Menus ##########################
Menu SaveMenu, Add, &Save`tCtrl+S, SaveG
Menu SaveMenu, Icon, &Save`tCtrl+S, shell32.dll, 259
Menu SaveMenu, Add, E&xit`tEsc,ForceExit
Menu SaveMenu, Icon, E&xit`tEsc, shell32.dll, 132
Menu FileMenu, Add, &File, :SaveMenu
Menu SettingsMenu, Add, &Show Tray Icon, HideIcon
Menu SettingsMenu, %CheckStatus%,&Show Tray Icon
Menu FileMenu, Add, &Settings, :SettingsMenu
Menu HelpMenu, Add, &Help`tF1, Help
Menu HelpMenu, Icon, &Help`tF1, shell32.dll, 24
Menu HelpMenu, Add, &About, About
Menu HelpMenu, Icon, &About, shell32.dll, 278
Menu FileMenu, Add, &Help, :HelpMenu
Gui Menu, FileMenu
Menu Tray, NoStandard
Menu Tray, Add, &Show, Show
Menu Tray, Add, &Show Icon, Hideicon
Menu Tray, %CheckStatus%, &Show Icon
Menu Tray, Add, &Exit, ForceExit
;####################### Menus ##########################
;####################### Gui ##########################
Gui Font, s7 c0x828282
Gui Add, Button, hWndWheelTestHw vWheelTestV x8 y8 w147 h120, &Place the Mouse Cursor Over This Area and Move the Wheel In One Direction ;gWheelTestG
Gui Font
ControlColor(WheelTestHw, hMainWnd, 0x800080, 0x444444)
RegRead , FixTimeInterval, HKEY_CURRENT_USER\SOFTWARE\WheelFixer , FixTimeInterval
Gui Add, Edit, vMsecondV x48 y168 w105 h21 +Number, % FixTimeInterval
Gui Add, Text, x8 y168 w36 h23 +0x200, M.Sec.:
Gui Add, Text, x8 y136 w30 h23 +0x200, Count:
Gui Add, Button, hWndhBtnSave3 gSaveG x96 y248 w58 h23, Save
Gui Add, Text, hWndCountHw vCountV x48 y136 w106 h23 +0x200 +Border +0x1000,
ControlColor(CountHw, hMainWnd, 0x89C5C5)
RegRead , RegAutoStart, HKEY_CURRENT_USER\SOFTWARE\WheelFixer , AuotoStart
if(RegAutoStart == 1)
CheckAutoStartStat := "Checked"
Gui Add, CheckBox, vAutoStartV gAutoStartG %CheckAutoStartStat% x8 y248 w74 h23, Auto Start
Gui Add, Text, x8 y200 w148 h2 +0x10
RegRead , RegFixMetodVal, HKEY_CURRENT_USER\SOFTWARE\WheelFixer , FixMetod
if(RegFixMetodVal == "Repair")
RepairStat := "Checked"
else
SkipStat := "Checked"
Gui Add, Radio, vRadioRepairV gRadioRepariG %RepairStat% x64 y208 w47 h23, Repair
Gui Add, Radio, vRadioSkipV gRadioSkipG %SkipStat% x120 y208 w39 h23, Skip
Gui Add, Text, x8 y240 w149 h2 +0x10
Gui Font, s8
Gui Add, Text, x8 y208 w50 h23 +0x200, Fix Metod:
Gui Font
Gui Add, StatusBar,vSbar, Waiting
Gui Add, ListView, hWndLVHw vLVv gLVg x168 y24 w210 h212, M.Sec|This Key|Prior Key
Gui Add, Button, gClearG x296 y248 w76 h24, Clear
Gui Add, Button, gSetMinTimeG x168 y248 w76 h24, Set Min. Time
Gui Add, Text, x168 y0 w127 h23 +0x200, Wheel Stuttering Intervals:
;####################### Gui ##########################
Global CUp := 0 ,CDown := 0
start = %1%
if(start == "")
Gui Show, w385 h303, Mouse Wheel Fixer
LV_ModifyCol(2, 72)
LV_ModifyCol(3, 72)
Return
GuiSize:
if (A_EventInfo = 1)
WinHide
return
Restore:
gui +lastfound
WinShow
WinRestore
return
SetMinTimeG:
If !(SelectedRow := LV_GetNext()){
GuiControl,,Sbar,No line was selected from the list.
Return
}
LV_GetText(RowText, SelectedRow)
GuiControl,,MsecondV, % RowText
GuiControl,,Sbar,Incorrect wheel entry range is set to: %RowText%
return
LVg:
MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
GuiControl,,MsecondV, % RowText
GuiControl,,Sbar,Incorrect wheel entry range is set to: %RowText%
}
return
ClearG:
LV_Delete()
GuiControl,,CountV,
GuiControl,,Sbar,The data has been cleared.
return
#if WinActivate MyGui
Escape::
MsgBox "df"
WinMinimize, MyGui
return
#if
GuiEscape:
GuiClose:
Exit:
WinMinimize
Return
ForceExit:
ExitApp
return
;GuiEscape:
;MsgBox % MyGui
;WinMinimize, MyGui ; Mouse Wheel Fixer ;GuiClose:
;ExitApp
Help:
helpcont =
(
The use of this application that corrects the stuttering problem in the mouse wheel:
You can test by dragging the mouse wheel over the square control area and turning it.
Stutterers will be automatically detected and listed.
The minimum interval in which stuttering becomes available will be entered automatically.
You can choose a different range from the list.
Fix Method Repair automatically corrects stuttering.
If Fix Method Skip happens, it ignores stuttering.
Feel free to guess and save the best settings for smooth scrolling.
)
Gui +OwnDialogs
MsgBox,32,Mouse Wheel Fier,% helpcont
Return
About:
aboutcontent =
(
It was developed by Hasan Salihoğlu in Autohotkey language.
For information: hasantr@ymail.com
)
Gui +OwnDialogs
MsgBox,64,Mouse Wheel Fier,% aboutcontent
Return
Show:
Gui Show, w385 h303, Mouse Wheel Fixer
Return
HideIcon:
;MsgBox % CheckStatus
if(CheckStatus = "Check"){
CheckStatus := "UnCheck"
Menu, Tray, NoIcon
}
else
{
CheckStatus := "Check"
Menu, Tray, Icon
}
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, ShowTryIcon,% CheckStatus
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, ShowTryIcon, % CheckStatus
Menu Tray, %CheckStatus%, &Show Icon
Menu SettingsMenu, %CheckStatus%,&Show Tray Icon
Return
SaveG:
;RegRead , RegFixMetodVal, HKEY_CURRENT_USER\SOFTWARE\WheelFixer , FixMetod
GuiControlGet, RepairV,,RadioRepairV
if(RepairV = 1)
FixMetodVal := "Repair"
else
FixMetodVal := "Skip"
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, FixMetod, % FixMetodVal
GuiControlGet,AutoStartStatus,,AutoStartV
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, AuotoStart,% AutoStartStatus
GuiControlGet,FixTimeInterval,,MsecondV
if FixTimeInterval <= 10
FixTimeInterval := 10
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, FixTimeInterval,% FixTimeInterval
RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, ShowTryIcon,% ShowTryIconVal
GuiControl,,Sbar, New Settings Saved
GuiControlGet,AutoStartStatus,,AutoStartV
if(AutoStartStatus == 1)
RegWrite, REG_SZ, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run,WheelFixerAutoStart,%A_ScriptFullPath% /systemStartup
else
RegDelete, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run,WheelFixerAutoStart
return
;if(CheckStatus == "UnCheck")
;RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, ShowTryIcon,"UnCheck"
;else
;RegWrite, REG_SZ ,HKEY_CURRENT_USER\SOFTWARE\WheelFixer, ShowTryIcon,"Check"
Return
AutoStartG:
GuiControlGet,AutoStartStatus,,AutoStartV
if AutoStartStatus = 1
GuiControl,,Sbar,Application will be initiated at system start.
else
GuiControl,,Sbar,Startup is disabled with the system.
Return
RadioRepariG:
GuiControl,,Sbar, Wrong wheel inlets will be adapted to the flow.
Return
RadioSkipG:
GuiControl,,Sbar, Wrong wheels will have their entries ignored.
Return
;####################### TEST ##########################
Fnc(){
MouseGetPos,,,,Cntrl
if(Cntrl == "Button1")
return 1
}
#If % Fnc()
WheelDown::
WheelUp::
#If
if A_ThisHotkey=WheelUp
CUp += 1
if A_ThisHotkey=WheelDown
CDown += 1
Gui, ListView,LVv
GuiControl,,CountV, % "WU:" CUp " WD:" CDown
GuiControl,,Sbar, % " Count WheelUp:" CUp " Count WheelDown:" CDown " Time Since Prior Hotkey: " A_TimeSincePriorHotkey
GuiControlGet,MinSec,,MsecondV
if(A_PriorHotKey!=A_ThisHotkey && (CUp + CDown) > 1 ) && (A_TimeSincePriorHotkey > 5) && (A_TimeSincePriorHotkey < 500){
LV_Insert(1,"",A_TimeSincePriorHotkey,A_ThisHotkey,A_PriorHotKey)
if((A_TimeSincePriorHotkey < MinSec || MinSec == ""))
GuiControl,,MsecondV,% A_TimeSincePriorHotkey
}
return
;####################### TEST ##########################
;####################### FIX ##########################
;https://autohotkey.com/board/topic/122211-fix-wheel-up-and-down-issue/
#if (WinActive("Mouse Wheel Fixer") != hMainWnd )
WheelUp::
WheelDown::
a += 1
if((PriorHotKeyx!=A_ThisHotkey) && A_TimeSincePriorHotkey < FixTimeInterval){
PriorHotKeyx := A_PriorHotKey
if(RepairStat == "Checked"){
SendInput, {%A_PriorHotKey%}
return
}
if(RepairStat != "Checked") ;else
return ;SendInput, {%A_PriorHotKey%} ;Send, {%A_ThisHotkey%}
;ToolTip % a
}
else
SendInput, {%A_ThisHotkey%}
PriorHotKeyx := A_ThisHotkey
return
#if
;####################### FIX ##########################
; http://www.autohotkey.com/board/topic/104539-controlcol-set-background-and-text-color-gui-controls/
ControlColor(Control, Window, bc := "", tc := "", Redraw := 1) {
a := {}
a["c"] := Control
a["g"] := Window
a["bc"] := (bc = "") ? "" : (((bc & 255) << 16) + (((bc >> 8) & 255) << 8) + (bc >> 16))
a["tc"] := (tc = "") ? "" : (((tc & 255) << 16) + (((tc >> 8) & 255) << 8) + (tc >> 16))
CC_WindowProc("Set", a, "", "")
If (Redraw) {
WinSet Redraw,, ahk_id %Control%
}
}
CC_WindowProc(hWnd, uMsg, wParam, lParam) {
Static Win := {}
If uMsg Between 0x132 And 0x138
If (Win[hWnd].HasKey(lParam)) {
If (tc := Win[hWnd, lParam, "tc"]) {
DllCall("gdi32.dll\SetTextColor", "Ptr", wParam, "UInt", tc)
}
If (bc := Win[hWnd, lParam, "bc"]) {
DllCall("gdi32.dll\SetBkColor", "Ptr", wParam, "UInt", bc)
}
Return Win[hWnd, lParam, "Brush"] ; Return the HBRUSH to notify the OS that we altered the HDC.
}
If (hWnd = "Set") {
a := uMsg
Win[a.g, a.c] := a
If (Win[a.g, a.c, "tc"] == "") And (Win[a.g, a.c, "bc"] == "")
Win[a.g].Remove(a.c, "")
If Not Win[a.g, "WindowProcOld"]
Win[a.g,"WindowProcOld"] := DllCall("SetWindowLong" . (A_PtrSize == 8 ? "Ptr" : "")
, "Ptr", a.g, "Int", -4, "Ptr", RegisterCallback("CC_WindowProc", "", 4), "UPtr")
If Win[a.g, a.c, "Brush"]
DllCall("gdi32.dll\DeleteObject", "Ptr", Brush)
If (Win[a.g, a.c, "bc"] != "")
Win[a.g, a.c, "Brush"] := DllCall("gdi32.dll\CreateSolidBrush", "UInt", a.bc, "UPtr")
Return
}
Return DllCall("CallWindowProc", "Ptr", Win[hWnd, "WindowProcOld"], "Ptr", hWnd, "UInt", uMsg, "Ptr", wParam, "Ptr", lParam, "Ptr")
}