microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.05k stars 6.53k forks source link

WinAPI function MouseScroll doesnt work due to things like xmouse style apps #13790

Open MikeKholomeev opened 3 years ago

MikeKholomeev commented 3 years ago

Microsoft PowerToys version

0.47.1

Running as admin

Area(s) with issue?

General, Awake, ColorPicker, FancyZones, FancyZones Editor, Image Resizer, Keyboard Manager, PowerRename, PowerToys Run, Settings

Steps to reproduce

Use app that sends WinAPI function to the specific window. In my case - it is AutoHotkey language script.

command (DocsMicrosoft link) SendMessage, 0x20A, "WheelUp", (mY<<16)|mX,, ahk_id %WinID%

, where 0x20A = WM_MOUSEWHEEL WinID = windows ID (handle)

I think it was working prion 0.47 version.

✔️ Expected Behavior

Should scroll content in PowerToys UI

❌ Actual Behavior

does nothin

Other Software

AutoHotkey v1.1.32.00

#Singleinstance force
#MaxHotkeysPerInterval 800
#InstallKeybdHook
#InstallMouseHook
#NoEnv         
SendMode Input
SetTitleMatchMode, 2 

TaskBarID := WinExist("ahk_class Shell_TrayWnd")

WheelUp::  ; Volume Control by mouseweel rotation on TaskBar
    MouseGetPos,,,Hwnd
    WinGetClass, Up_Down_Win_Class, ahk_id %Hwnd% ; get window class under mouse cursor

    If Up_Down_Win_Class in Windows.UI.Core.CoreWindow,ApplicationFrameWindow
    ; if it is "Start" button
    {
        Send, {WheelUp}
        Return ; finish hotkey
    }
  If(Hwnd = TaskBarID)
    {
    SoundSet, +5
    GoSub, Show_Sound
    }
  Else
    Goto, All_Up_Down
Return

WheelDown::  ; Volume Control by mouseweel rotation on TaskBar
    MouseGetPos,,,Hwnd
    WinGetClass, Up_Down_Win_Class, ahk_id %Hwnd% ; get window class under mouse cursor

    If Up_Down_Win_Class in Windows.UI.Core.CoreWindow,ApplicationFrameWindow 
    ; if it is "Start" button
    {
        Send, {WheelDown}
        Return 
    }
  If(Hwnd = TaskBarID)
    {
    SoundSet, -5
    GoSub, Show_Sound
    }
  Else
    Goto, All_Up_Down
Return

Show_Sound:
return

All_Up_Down: ; Scrolling content in the window under the mouse pointer, instead of the active window.
    Critical
    If(A_ThisHotkey!=A_PriorHotkey || A_TimeSincePriorHotkey>40) 
        Scroll:= A_ThisHotkey="WheelUp" ? 120<<16 : -120<<16   
    Else                                                        
        Scroll:= A_ThisHotkey="WheelUp" ? 240<<16 : -240<<16    

    CoordMode, Mouse, Screen
    MouseGetPos, mX, mY
    mX &= 0x00000000FFFFFFFF
    Point := mX | mY<<32
    WinID:=DllCall("WindowFromPoint", "int64", Point, "ptr")   ; ID (handle) 
    Point := mX | (mY-20)<<32                                  
    NextID:=DllCall("WindowFromPoint", "int64", Point, "ptr")
    mX &= 0x0000FFFF
    SendMessage, 0x20A, %Scroll%, (mY<<16)|mX,, ahk_id %WinID%   ; 0x20A = WM_MOUSEWHEEL
    If (!ErrorLevel && (WinID != NextID))
        SendMessage, 0x20A, %Scroll%, (mY<<16)|mX,, ahk_id %NextID%
Return
crutkas commented 2 years ago

Do you have X-Mouse Button Control running? or something simular?

crutkas commented 2 years ago

Also which exact items are not working

ghost commented 2 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 5 days. It will be closed if no further activity occurs within 5 days of this comment.

MikeKholomeev commented 2 years ago

Do you have X-Mouse Button Control running? or something simular?

Hi! I've tried two tools - the first is written above AHK script, the second is an application MouseImp (https://www.mouseimp.com/download/ . It hooks scrolling on the right mouse button, so you can perform scrolling by press&hold RMB and moving mouse up/down).

As a result - I switched off the AHK script, and can give feedback only relying on MouseImp use.

Feedback:

Prerequisite:


- restart MouseImp 

` wndclass="HwndWrapper[PowerToys"` is the name of the class of the PowerToys 0.51.1 Settings window. The name should not match exactly. It matches by the first symbols
Jay-o-Way commented 2 years ago

Is this still an issue?

MikeKholomeev commented 2 years ago

Yes.

...I can shoot a screen video for understanding.

MikeKholomeev commented 2 years ago

But, my issue is not with XMouseButtonControl app, my issue is with the application MouseImp (https://www.mouseimp.com/download/ . It hooks scrolling to the right mouse button, so you can perform scrolling by press&hold RMB and moving the mouse up/down).

crutkas commented 2 years ago

Asking around again here. @gabbybilka fyi

Jay-o-Way commented 1 year ago

Copy-paste comment from @nandoputrap:

Hi! The issue also come after updating Firefox 110. I found the solution here: https://techdows.com/2023/02/fix-mouse-wheel-scrolling-not-working-firefox.html

It works on me. I also can scroll on some apps like Power Toys and Files

Summary: Disable / Uncheck this setting on XMBC

image

MikeKholomeev commented 1 year ago

Thank you for the suggestion, but my app doesn't have the setting :(

ParadoxV5 commented 1 year ago

Moving my comment at https://github.com/microsoft/PowerToys/issues/23212#issuecomment-1661109983 here.

My scroll wheel does nothing when PowerToys settings, Peek, or possibly other components too are foreground. Not even trying to scroll a background window (“Scroll inactive windows when hovering over them” has always been on, so #20961 would not apply).

My trackpad is not affected. The difference is that the mouse has a driver which I use to rebind buttons, hence it’s similar to this issue.

This also affects Task Manager and RegEdit, hinting that it’s an issue in the underneath UI library. In contrast, Windows Explorer, Settings and Terminal are not affected.