Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In C++, how can I programmatically detect the reverse scrolling setting on Windows?

Tags:

c++

windows

Specifically I want to determine the state of the Windows setting for Mouse / Touchpad -> "Reverse scrolling direction" (which defaults to off). Ideally this would be extracted from the event data but a falling back to querying the current OS state would be sufficient. I wasn't able to find either solution in the MSDN documentation.

Note: That setting is only available in the mouse / trackpad settings on Windows 8 or Windows 10 and only if you have a precise scrolling device (like a Surface Pro 3).

like image 535
Jesse Z Avatar asked Feb 19 '26 18:02

Jesse Z


2 Answers

I know of a few "standard" or "official" approaches to getting system information.

  • GetSystemMetrics
  • SystemParametersInfo
  • WMI

If none of these work and you can't find info in MSDN, then @Steve314's suggestion of checking the registry is probably the way to go. One approach to identifying the correct registry key:

  1. Open the Mouse / Touchpad control panel and get ready to change the setting.
  2. Download and run Process Monitor.
  3. Change the setting in the Mouse / Touchpad control panel.
  4. Search for RegSetValue calls in Process Monitor's output to try and find the one that corresponds to the setting you care about.
like image 113
Josh Kelley Avatar answered Feb 21 '26 06:02

Josh Kelley


I wasn't able to find the scrolling direction via the other suggestions, but I was able to find the registry key using the Process Monitor suggestion. The registry key is: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\ScrollDirection

Thanks!

like image 42
Jesse Z Avatar answered Feb 21 '26 06:02

Jesse Z



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!