I would like to use the innards of an optical mouse (Microsoft BlueTrack) to sense the surface velocity of an arbitrarily-rotating sphere by feeding the x and y relative position changes (along with accurate sample times) directly into Mathematica 7.

The v.7 MousePosition function is confined to the cell/window/screen coordinates and does not seem to allow for unbounded motion, or the removal of any mouse driver filtering.

I probably need to use the Windows user32.dll functions for reading raw mouse data --

Raw Input: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645536(v=vs.85).aspx

RAWMOUSE structure: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645578(v=vs.85).aspx

-- where my primary interest is in the lLastX and lLastY values (with signed relative motion selected by usFlags), along with the sample times, but I don't have the C++/# programming chops to make this work.

Can anyone show me, with sample code, how to access these values in real-time from Mathematica 7?

  • $\begingroup$ MMA 7 is obsolete. Would it be possible for you to upgrade? Any methods proposed run a risk of not working on your system. $\endgroup$ – MarcoB Aug 5 '17 at 18:47
  • $\begingroup$ Due to budget constraints, the lab is stuck with v.7 for a while... $\endgroup$ – dynamech Aug 5 '17 at 18:48
  • $\begingroup$ If the solution involves NET/Link or J/Link, it might be upward-compatible with the current MMA version, providing an alternative to built-in device functions. $\endgroup$ – dynamech Aug 8 '17 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.