DirectInput: mouse input with time stamp,

Closed Posted Aug 18, 2005 Paid on delivery
Closed Paid on delivery

I need to save mouse co-ordinates when a user moves the mouse FAST inside a window (like a jerky movement). The coordinates will be saved into a notepad file with 'exact time' (millisecond precision) for each co-ordinate. A normal mouse has a sampling rate of less than 200 Hz. So, if a mouse moves for 1 sec, it sends about 200 coordinates to the system. I am expecting a notepad file in the following form: Time (s) X Y 0.000 156 86 0.005 156 89 0.010 157 90 … … … From the "Control Panel" of Windows, when the mouse hardware can support the maximum sampling rate up to 200Hz, we can change the sampling rate settings of the mouse to 80 Hz, 100 Hz and 200 Hz??" in each case we are expecting data (mouse co-ordinates X and Y) at the interval of 0.005 ms, 0.01 ms and 0.0125 ms respectively. Here is the crucial part: It is VERY easy to write a program in VB.Net or C++ .Net that collects mouse coordinates and the time for each coordinate. But, the time is NOT very accurate. And also because of the way mouse events and messages are queued and event handlers invoked, sometimes coordinates are lost and are not collected by a simple application. As the precision and accuracy of the time stamp are big concerns, I am suggesting using DirectX, specifically the "DIDEVICEOBJECTDATA Structure" of DirectInput because besides the mouse co-ordinates it also provides the time stamp of the co-ordinates. I need an application that will provide a window (of a particular size) where the user will be asked to move the mouse while holding the left mouse button down. As the user moves the mouse inside the window, the movement should be DRAWN on a window and the application will collect the mouse co-ordinates (with respect to the application Window) as well as an accurate time stamp for the co-ordinates using DirectInput (DirectX). Once the rapid movement is over, the application saves the collected data ??" (time with 5 ms interval, X co-ordinate and Y co-ordinate) in a “*.txt?? file.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

1) The code should be well-documented in English. Not in any other language. 2) I request you to send properly functional code (with no compilation and debugging error) and that can produce workable *.exe file. To make this project work, I recommend you to look at the following codes: There are two very good examples given with DirectX SDK installations. They are located at: Source: (SDK root) \Samples\C++\DirectInput\Mouse Source: (SDK root) \Samples\C++\DirectInput\Scrawl The first “Mouse?? example shows how we can use the mouse device using DirectInput. It clarifies the following things which are necessary for this project: Setting Up DirectInput The following two procedures have to be performed once only. The DirectInput object is then ready to manage all mouse and keyboard devices attached to the system. --Create the DirectInput object. --Enumerate the devices. Setting Up a Device --Create the device. --Set the cooperative level. Here, in our program it should be FOREGROUND, EXCLUSIVE AND BUFFERED. --Set the data format. Here, it should be mouse. --Set properties. This is the most crucial step of this project. Three things to be done in this stage: i) The buffer size should be set. ii) The mouse co-ordinates should be returned in absolute position of the window. “When the axis mode is set to absolute, the coordinates are a running total of all relative motions received by DirectInput. The axis coordinates are not initialized to any particular value when the device is acquired, so your application should treat absolute values as relative to an unknown origin. You can record the current absolute position whenever the device is acquired and save it as the virtual origin. This virtual origin can then be subtracted from subsequent absolute coordinates retrieved from the device to compute the relative distance that the mouse has moved from the point of acquisition.?? iii) If you use the ‘dwTimeStamp’ of the DIDEVICEOBJECTDATA structure to get the timing parameter. (You can also look at the sample “[url removed, login to view]? file to have a look at the way a different timer is used to poll the mouse. If you don’t want to use the ‘dwTimeStamp’, you can use the SetTimer??"the way it has been used there) “When Microsoft® DirectInput® input data is buffered (see Buffered and Immediate Data), each DIDEVICEOBJECTDATA structure contains not only information about the type of event and the device object associated with it. It also contains a time stamp and a sequence number. The ‘dwTimeStamp’ member contains the system time, in milliseconds, at which the event took place. This is equivalent to the value that would have been returned by the Microsoft Win32® GetTickCount function, but at a higher resolution.?? --Acquire the device. The second example ("[url removed, login to view]") shows how to draw lines smoothly on the windows using DirectInput with the mouse. It has also a better interface (which is a small window) and it can be closed (with the cross sign at the top right corner).

## Platform

Code should be written in Visual C++ on Microsoft Visual Studio .NET (2002) platform to be run on Windows XP.

C Programming Chrome OS Engineering Linux Mac OS MySQL PHP Software Architecture Software Testing UNIX Windows Desktop

Project ID: #3857887

About the project

7 proposals Remote project Active Sep 9, 2005

7 freelancers are bidding on average $50 for this job

repmovsd

See private message.

$59.5 USD in 3 days
(153 Reviews)
7.1
IWSolutions

See private message.

$59.5 USD in 3 days
(108 Reviews)
6.7
triadanetteam

See private message.

$34 USD in 3 days
(6 Reviews)
1.4
savedsoftwarellc

See private message.

$50.15 USD in 3 days
(0 Reviews)
0.0
vw1411784vw

See private message.

$59.5 USD in 3 days
(1 Review)
0.0
aureolegames

See private message.

$42.5 USD in 3 days
(2 Reviews)
0.0
alexflvw

See private message.

$42.5 USD in 3 days
(0 Reviews)
0.0