Accessing a mouse button

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2005
Posts: 6
Reputation: dave2point0 is an unknown quantity at this point 
Solved Threads: 0
dave2point0 dave2point0 is offline Offline
Newbie Poster

Accessing a mouse button

 
0
  #1
Mar 27th, 2005
Hi, I am making some software for microchips. I am currently developing some algorithms or the PC, and was wondering if there is a way to access a mouse button in very simple C, not c++, in the form of a variable, either on or off. Also, switch bounce is not an issue, as I would like to accommadate for this in the programming

Thanks in advance,

Dave
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,109
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 943
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Accessing a mouse button

 
0
  #2
Mar 27th, 2005
Not knowing what operating system you are using, here is some old and ugly Turbo C code. You could leave out the x,y info. It contains the one big hint, that you might as well use assembler ...
  1. /************************** m_releas.cf ******************************
  2. **
  3. ** Returns pointers to the coordinate values x, y of the mouse cursor
  4. ** position at which the button was clicked (x, y values jump in steps
  5. ** of 8 in text mode). Also returns a pointer to the number of times
  6. ** the button was released. This value will reset to 0 after the call.
  7. ** This function is preferred over the m_button_press() function.
  8. ** call m_button_release(0, &x, &y, &rnum)
  9. **
  10. ** Written in TURBO C V.2.0 by vegaseat 2/13/89
  11. **
  12. ************************************************************************/
  13.  
  14. void m_button_release(int button, int *x, int *y, int *rel)
  15. /* mouse function #6, find out how many times a button has been released */
  16. /* which button left = 0, right = 1 Returns position x (0-639),y (0-199) */
  17. /* at which the click occured and number of releases, call resets to 0 */
  18. { /* needs DOS.H and union REGS inreg, outreg */
  19. inreg.x.ax = 6;
  20. inreg.x.bx = button;
  21. int86(0x33,&inreg,&outreg);
  22. *x = outreg.x.cx;
  23. *y = outreg.x.dx;
  24. *rel = outreg.x.bx;
  25. }
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 6
Reputation: dave2point0 is an unknown quantity at this point 
Solved Threads: 0
dave2point0 dave2point0 is offline Offline
Newbie Poster

Re: Accessing a mouse button

 
0
  #3
Mar 28th, 2005
Originally Posted by vegaseat
Not knowing what operating system you are using,
I'm using windows XP

Ummmmm.... Sorry, I'm not very good at C, do you know how I could translate this info into a variable (i.e. 1 of button down & 0 for button up), because I only need to access the state of the mouse button, not the X, Y. Well, thanks loads anyway
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 6
Reputation: dave2point0 is an unknown quantity at this point 
Solved Threads: 0
dave2point0 dave2point0 is offline Offline
Newbie Poster

Re: Accessing a mouse button

 
0
  #4
Mar 28th, 2005
Also, I get all these errors:
Sorry if this is something obvious - not one of my bios program has even nearly done what it was supposed to

Warning W8065 C:\c\button.c 9: Call to function 'm_button_release' with no prototype in function main
Error E2356 C:\c\button.c 19: Type mismatch in redeclaration of 'm_button_release'
Error E2451 C:\c\button.c 20: Undefined symbol 'inreg' in function m_button_release
Error E2451 C:\c\button.c 22: Undefined symbol 'outreg' in function m_button_release
Warning W8065 C:\c\button.c 22: Call to function 'int86' with no prototype in function m_button_release
Warning W8057 C:\c\button.c 26: Parameter 'button' is never used in function m_button_release
Warning W8057 C:\c\button.c 26: Parameter 'x' is never used in function m_button_release
Warning W8057 C:\c\button.c 26: Parameter 'y' is never used in function m_button_release
Warning W8057 C:\c\button.c 26: Parameter 'rel' is never used in function m_button_release
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC