Please support our C++ advertiser: Programming Forums
![]() |
Hey guys,
We're trying to work with a driver program for our robot. If we can grab the x and y coordinates of the Mouse we could send them to the controller for driving. Does anyone know how to capture the mouse movement into an integer?
We're trying to work with a driver program for our robot. If we can grab the x and y coordinates of the Mouse we could send them to the controller for driving. Does anyone know how to capture the mouse movement into an integer?
It is practically impossible to teach good programming style to students that have had prior exposure to Basic; as potential programmers they are mentally mutilated beyond hope of regeneration.
-Edsger Dijkstra
-Edsger Dijkstra
maybe:
http://www.daniweb.com/forums/thread67435.html
my output
I don't know about visual c++ but the above seems to work in dev-cpp I think.
http://www.daniweb.com/forums/thread67435.html
cplusplus Syntax (Toggle Plain Text)
#include <windows.h> #include <iostream> using namespace std; int main() { while ( 1 ) { Sleep ( 500 ); POINT pos; GetCursorPos ( &pos ); // here is your coordinates int x = pos.x; int y = pos.y; cout << "x pos:" << x << endl; cout << "y pos:" << y << endl << endl; } return 0; }
my output
x pos:377 y pos:272 x pos:377 y pos:272 x pos:377 y pos:272 x pos:585 y pos:380 x pos:360 y pos:142 x pos:379 y pos:161 x pos:424 y pos:271 x pos:424 y pos:271 x pos:488 y pos:302 x pos:502 y pos:323 x pos:502 y pos:323
I don't know about visual c++ but the above seems to work in dev-cpp I think.
Last edited by iamthwee : Aug 22nd, 2008 at 1:01 pm.
*Voted best profile in the world*
![]() |
Similar Threads
Other Threads in the C++ Forum
Other Threads in the C++ Forum
- Previous Thread: error in script
- Next Thread: how to read a binary file data to a monitor
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode