New version released:
RollMouse watches mouse input, and can also send mouse output. Previously, when sending output (ie during a Roll), I had to turn off watching for input while I sent the output.
But I needed to be watching for input while mid-roll, because as soon as I see input coming from the actual mouse, the roll should stop.
I just learned a new trick by examining the source code for EitherMouse
- you can use the following code in the OnMessage callback that handles your WM_INPUT messages, and extract the Device ID of the mouse that sent the movement
Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus
VarSetCapacity(raw, 40, 0)
If (!DllCall("GetRawInputData",uint,lParam,uint,0x10000003,uint,&raw,"uint*",40,uint, 16) or ErrorLevel)
ThisMouse := NumGet(raw, 8)
if (ThisMouse == 0)
return ; Filter mouse movement that was sent using mouse_event
; If the code gets here, the movement was generated by a real mouse
So RollMouse now uses this technique, instead of turning on and off Message handling many times a second. This appears to have lowered CPU usage quite significantly.