Board index » cppbuilder » mouse question...???

mouse question...???


2005-09-30 12:45:40 AM
cppbuilder52
/* mice.c-win xp-bc5.02-tc3.0*/
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <dos.h>
// and masks for mouse buttions bit 0>1 and bit 1>2
#define LBUTP 1
#define RBUTP 2
int main(void)
{
union REGS regs;
int c=0, b=0;
regs.x.ax = 0x1; // show mouse pointer
int86(0x33, ®s, ®s);
clrscr();
while( c != 'e')
{
c=getch();
regs.x.ax = 0x3; // retun button status & co-ords
int86(0x33, ®s, ®s);
b=regs.x.bx;
if(b & LBUTP )//if left button pressed
{
gotoxy(regs.x.cx, regs.x.dx);// goto x y co-ords
putch('x');// print this- but this does not happen
}
}
return 0;
}
 
 

Re:mouse question...???

Hi Wayne,
thanx for ur help, but
how this works>>gotoxy((regs.x.cx/8)+1, (regs.x.dx/8)+1);// goto x y
co-ords
, why did this not work>>gotoxy(regs.x.cx, regs.x.dx);
any explanation or logic for this,
thanx
mujeebrm
"Wayne A. King" < XXXX@XXXXX.COM >wrote in message
Quote
>if(b & LBUTP )//if left button pressed
>{
>gotoxy(regs.x.cx, regs.x.dx);// goto x y co-ords

Try this:

gotoxy((regs.x.cx/8)+1, (regs.x.dx/8)+1);// goto x y co-ords