Search code examples
scrollvbscript

How to simulate mouse scrolling


I am working on a project, I would like help to simulate values ​in mouse scrolling, a path that I have been researching is this.

Set WX = CreateObject("DynamicWrapperX")
     
WX.Register "user32.dll", "GetActiveWindow", "r=l"
WX.Register "user32.dll", "PostMessageA", "i=hlll", "f=s", "r=l"
WX.Register "user32.dll", "ShowScrollBar", "i=hlp" 
    
WX.Register "user32.dll", "SetScrollPos", "i=hlll" 
     
WX.ShowScrollBar WX.GetActiveWindow(), 3, "1" 
WX.SetScrollPos 0, 1, 100000, 1
WX.PostMessageA WX.GetActiveWindow(), 277, 4 + 65536 * 100, 0

I got something using dynamicwrapperx, but the code creates a new scroll, and that's not what I need


Solution

  • I managed to solve the problem using DynamicWrapperX.

    Sub CommandButton1_Click()
        Set WX = CreateObject("DynamicWrapperX")    
        WX.Register "user32.dll", "mouse_event", "i=uuulu", "f=s"
        WX.mouse_event 2048, 0, 0, -10, 0
    End Sub