Jump to content
  • Advertisement
Sign in to follow this  
atreyu

Low level mouse filtering

This topic is 4847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anykone now a way to recieve (and modify) mouse information near the driver level so it can be modified before being used by any applications? I want to insert a low-pass filter to remove high frequency motion components (ie. shaking from diseases like parkinson's). IBM Research has done something similiar to this with a custom mouse driver and a really awful averaging filter. I want to try improving on what they did but I'd rather find a more elegant way than writing a mouse driver if possible. Thanks, --Ben /Wow, It has been a long time since I posted here...

Share this post


Link to post
Share on other sites
Advertisement
If you are dealing with Win32, you can use SetWindowsHookEx with WH_MOUSE_LL along with your own LowLevelMouseProc.

Share this post


Link to post
Share on other sites
Can I modify the data with a hook and then pass it on? I played around with one last week but couldn't seem to actually modify the mouse coordinates (just read them).

If I'm just missing something, that would be perfect.

Thanks,
--Ben

Share this post


Link to post
Share on other sites
I believe you can modify the message, but I'm not sure. Give it a try and post back. It will probably go something like this:

LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < 0)
return CallNextHookEx(mouseLLHook, nCode, wParam, lParam);

// Are we expected to handle this callback?
if (instance && nCode == HC_ACTION)
{
MSLLHOOKSTRUCT *hook = reinterpret_cast<MSLLHOOKSTRUCT *>(lParam);
if (wParam == WM_LBUTTONDOWN || wParam == WM_LBUTTONUP)
{
POINT pt = { hook->pt.x, hook->pt.y };
HWND hwnd = WindowFromPoint(pt);
}
}
// Otherwise, pass on the message
return CallNextHookEx(mouseLLHook, nCode, wParam, lParam);
}


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!