I'm kind of a beginner to this sort of programming in C/C , I've only done a few introductory courses in college. I was wondering how I would go about writing a mouse tracking application for a windows XP machine using the bloodshed Dev C++ compiler.
What I basically need to do is to grab the x and y coordinates of the cursor every XX number of microseconds until I tell it to stop.
I've also never programmed win32 applications, so I was wondering if it was possible to run this from a console application.
Hello Rodolphe, thank you for the question.
I think you would be better off making this a standard Win32 application. It should be pretty easy to do what you want to do. You can use the method GetTickCount() that returns the amount of milliseconds since the system started running to do your time tracking, and GetCursorPos, and SetCursorPos for mouse positioning.
Here is documentation from the MSDN:
Here is some pseudocode:
// In your app
DWORD start = GetTickCount();
// do some stuff
DWORD end = GetTickCount();
if(end - start > 5) // 5 milliseconds later
cout << "The cursor x is: " << p.x << " and y is: " p.y;
That should point you in the right direction.
I hope this information was helpful.