RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 332 | Replies: 1 | Thread Tools  Display Modes
Reply
Join Date: Jun 2006
Location: USA
Posts: 1,088
Reputation: Duki has a spectacular aura about Duki has a spectacular aura about Duki has a spectacular aura about 
Rep Power: 7
Solved Threads: 4
Duki's Avatar
Duki Duki is offline Offline
Veteran Poster

MouseMove in Visual C++

  #1  
Aug 22nd, 2008
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?
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 4,844
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 325
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: MouseMove in Visual C++

  #2  
Aug 22nd, 2008
maybe:
http://www.daniweb.com/forums/thread67435.html


  1. #include <windows.h>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. while ( 1 )
  8. {
  9. Sleep ( 500 );
  10. POINT pos;
  11. GetCursorPos ( &pos );
  12. // here is your coordinates
  13. int x = pos.x;
  14. int y = pos.y;
  15.  
  16. cout << "x pos:" << x << endl;
  17. cout << "y pos:" << y << endl << endl;
  18. }
  19. return 0;
  20. }

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*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C++ Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 7:36 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC