Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Middle click then Roll
#1
Function where middle click, then waits for roll up or down to make volume go up or down?

Would base on SimpleMouseGestures

-Jim
#2
Function mouse_middle_and_wheel_trigger
Trigger #M 0x8     Help - how to add the trigger to the macro
Code:
Copy      Help
function nCode wParam MSLLHOOKSTRUCT&h

if getopt(nargs)=0
,if(getopt(nthreads)>1) ret
,int-- t_hh=SetWindowsHookEx(WH_MOUSE_LL &mouse_middle_and_wheel_trigger _hinst 0)
,MessageLoop
,ret

;---- this code runs on each mouse event while wheel is pressed -----

int-- t_wheel_used
sel wParam
,case WM_MBUTTONUP
,UnhookWindowsHookEx t_hh
,if(!t_wheel_used) mid
,shutdown -7
,
,case WM_MOUSEWHEEL
,t_wheel_used=1
,if h.mouseData>0
,,out "forward"
,else
,,out "backward"
,ret 1 ;;eat

ret CallNextHookEx(0 nCode wParam &h)
#3
Sweet.

I was able to combine this with simple_mouse_gestures2 example for middle click. See any better way to do it?

Function Simple_mouse_gestures2
Trigger #M 0x8     Help - how to add the trigger to the macro
Code:
Copy      Help
function nCode wParam MSLLHOOKSTRUCT&h

int i=SimpleMouseGestures("" 0 10 1)
out i
if i>0
,shutdown -6 0 "SimpleMouseGestures"
,ret

if getopt(nargs)=0
,if(getopt(nthreads)>1) ret
,int-- t_hh=SetWindowsHookEx(WH_MOUSE_LL &mouse_middle_and_wheel_trigger _hinst 0)
,MessageLoop
,ret

;---- this code runs on each mouse event while wheel is pressed -----
;
int-- t_wheel_used
sel wParam
,case WM_MBUTTONUP
,UnhookWindowsHookEx t_hh
,if(!t_wheel_used) mid
,shutdown -7

,case WM_MOUSEWHEEL
,t_wheel_used=1
,if h.mouseData>0
,,out "forward"
,else
,,out "backward"
,ret 1 ;;eat

ret CallNextHookEx(0 nCode wParam &h)
#4
Does not work.

This works, but probably it is not the best way, need more work to combine correctly.
Function mouse_middle_and_wheel_trigger
Trigger #M 0x8     Help - how to add the trigger to the macro
Code:
Copy      Help
function nCode wParam MSLLHOOKSTRUCT&h

if getopt(nargs)=0
,if(getopt(nthreads)>1) ret
,int-- t_hh=SetWindowsHookEx(WH_MOUSE_LL &mouse_middle_and_wheel_trigger _hinst 0)
,;MessageLoop
,int i=SimpleMouseGestures("") ;;this func processes messages, threfore can replace MessageLoop
,;out i
,ret

;---- this code runs on each mouse event while wheel is pressed -----
;
int-- t_wheel_used
sel wParam
,case WM_MBUTTONUP
,UnhookWindowsHookEx t_hh
,;if(!t_wheel_used) mid ;;don't know why this would make double click, just disabled it
,shutdown -7

,case WM_MOUSEWHEEL
,t_wheel_used=1
,if h.mouseData>0
,,out "forward"
,else
,,out "backward"
,ret 1 ;;eat

ret CallNextHookEx(0 nCode wParam &h)
#5
Strange. Worked on my computer at work and does not work at home.
#6
Ok. So if I have the function "mouse_middle_and_wheel_trigger" with middle click assigned and my "Simple_mouse_gestures2" edit, it works.
Strange way to do it for sure.

I've never accidentally made something work in programming before.


Forum Jump:


Users browsing this thread: 1 Guest(s)