tags:

views:

583

answers:

1

I'm looking to create a global mouse hook that works in XP/Vista/7 which would allow me to access the X,Y values that the mouse is inputting, and modify those values before they hit Windows...

I also want to be able to simulate mouse inputs in between actual mouse inputs...

For example, lets say our inputs looked like this:

1: 1,0 2: 2,0 3: 3,0 4: ?,?

I want to be able to intercept input number 4 and run it through an 'if' statement: If the value of the input matches certain parameters, I want to modify the value by adding or subtracting from it...

A USB Mouse has a default polling rate of 125Hz and a maximum of 1000hz...

If possible (especially when the polling rate is set less than 1000hz) I would like to 'inject' inputs 'between' actual mouse updates (critical) so for example:

(in milliseconds)

0008 - 1,0 0016 - 1,0 0032 - 2,0

So the mouse is updating at 125Hz... Could I detect the frequency of inputs, and send an input every other input??? So for example I could 'double' the mouse frequency from 125hz to 250hz, and simulate my own 'in between' updates based on whatever rules I set...

Does any of these seem reasonable? Right now I am working in C# and I was working with the "Gma.UserActivityMonitor" from this tutorial here: http://www.codeproject.com/KB/cs/globalhook.aspx but for some reason I get a performance hit which makes utilizing this code with fullscreen games have an unusable lag on the mouse inputs due to the hook...

Perhaps I need to write something in C++? Any help would be greatly appreciated. Thanks!

A: 

Hopefully this link on grabbing raw mouse input will be helpful, it includes a library written for C# as well as a C++ version. It is meant to enable the use of multiple mice in Windows but hopefully you can emulate what it's using for what you want to accomplish.

Darth Continent

related questions