Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Horizontal Mouse Scrolling
#1
Hi,

how can I simulate horizontal mouse scrolling?
Is it possible?

Thanks
#2
This works with some windows.
Function MouseWheelH
Code:
Copy      Help
;/
function ^nticks [hwnd] ;;nticks: >0 forward, <0 backward.

;Mouse horizontal wheel.

;nticks - number of wheel ticks to scroll to the right (positive) or left (negative).
;hwnd - handle of a child window. If used, sends mouse wheel message directly to the child window.

;REMARKS
;Does not work on Windows 2000, XP, 2003. Works only with windows that support horizontal scrolling message WM_MOUSEHWHEEL added in Windows Vista.
;The auto delay (spe) is applied, except when hwnd used.


def WM_MOUSEHWHEEL 0x020E
def MOUSEEVENTF_HWHEEL 0x01000

if(hwnd)
,int i
,ifk(C) i|MK_CONTROL
,ifk(S) i|MK_SHIFT
,ifk((1)) i|MK_LBUTTON
,ifk((2)) i|MK_RBUTTON
,ifk((4)) i|MK_MBUTTON
,ifk((5)) i|MK_XBUTTON1
,ifk((6)) i|MK_XBUTTON2
,SendMessage hwnd WM_MOUSEHWHEEL nticks*120<<16|i ym<<16|xm
else
,INPUT in.mi.dwFlags=MOUSEEVENTF_HWHEEL
,in.mi.mouseData=nticks*120
,in.mi.dwExtraInfo=1354291109
,SendInput 1 &in sizeof(INPUT)
,wait -2
#3
This works with most other windows.
Function MouseWheelH2
Code:
Copy      Help
;/
function nticks [hwnd] [flags] ;;nticks: >0 to right, <0 to left.   flags: 1 window from mouse, 2 pages, 4 full

;Mouse horizontal wheel.

;nticks - number of wheel ticks to scroll to the right (positive) or left (negative).
;hwnd - handle of a child window to scroll. If not used, scrolls the focused child window.

;REMARKS
;Sends WM_HSCROLL message. Does not work with windows that don't support the message.
;In some windows, scrollbars are separate controls, usually of class "ScrollBar". Then this function probably will not work.


if(!hwnd) hwnd=iif(flags&1 child(mouse) child)
int m; if(nticks>0) m=SB_LINERIGHT; else m=SB_LINELEFT; nticks=-nticks
if(flags&2) m+2; else if(flags&4) m+6
rep(nticks) SendMessage hwnd WM_HSCROLL m 0
#4
For other windows try to click scrollbar accessible object.
Example.
Macro Macro2275
Code:
Copy      Help
int w=win("Downloads" "CabinetWClass")
Acc a.Find(w "PUSHBUTTON" "Page right" "class=ScrollBar" 0x25)
if(a.a) a.DoDefaultAction


Forum Jump:


Users browsing this thread: 1 Guest(s)