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

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 ...

/**************************  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;
}

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

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

This question has already been answered. Start a new discussion instead.