| | |
MouseMove in Visual C++
![]() |
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
C++ 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
C++ Syntax (Toggle Plain Text)
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
- Previous Thread: error in script
- Next Thread: how to read a binary file data to a monitor
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes classified code coding compatible compile console conversion count date delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file filewrite forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper homeworksolutions iamthwee icon if...else ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node object output play pointer problem program programming project python random read recursion reference rpg string strings struct symbol temperature template test text text-file toolkit tree url values variable vector video win32 windows winsock wordfrequency wxwidgets






