| | |
Accessing a mouse button
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2005
Posts: 6
Reputation:
Solved Threads: 0
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
Thanks in advance,
Dave
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 ...
C++ Syntax (Toggle Plain Text)
/************************** m_releas.cf ****************************** ** ** Returns pointers to the coordinate values x, y of the mouse cursor ** position at which the button was clicked (x, y values jump in steps ** of 8 in text mode). Also returns a pointer to the number of times ** the button was released. This value will reset to 0 after the call. ** This function is preferred over the m_button_press() function. ** call m_button_release(0, &x, &y, &rnum) ** ** Written in TURBO C V.2.0 by vegaseat 2/13/89 ** ************************************************************************/ void m_button_release(int button, int *x, int *y, int *rel) /* mouse function #6, find out how many times a button has been released */ /* which button left = 0, right = 1 Returns position x (0-639),y (0-199) */ /* at which the click occured and number of releases, call resets to 0 */ { /* needs DOS.H and union REGS inreg, outreg */ inreg.x.ax = 6; inreg.x.bx = button; int86(0x33,&inreg,&outreg); *x = outreg.x.cx; *y = outreg.x.dx; *rel = outreg.x.bx; }
May 'the Google' be with you!
•
•
Join Date: Mar 2005
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by vegaseat
Not knowing what operating system you are using,
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
•
•
Join Date: Mar 2005
Posts: 6
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- mouse button mapping (Getting Started and Choosing a Distro)
- Microsoft Wireless Optical Mouse 2.0 - Middle Button (USB Devices and other Peripherals)
- Left mouse button will not work (Viruses, Spyware and other Nasties)
- left mouse button and keyboard stop working after minutes/hours (Viruses, Spyware and other Nasties)
- Locking the mouse button down (C)
Other Threads in the C++ Forum
- Previous Thread: Recursion: when do you use it?
- Next Thread: Is there an array[x][y][z] in C++ (i.e TRIPLE ARRAY)???
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph homeworkhelp iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






