Thursday, March 19, 2009

C Program Handling Mouse

#include <iostream.h>
#include <dos.h>
#include <conio.h>

void showm()
{
_AX = 1;
geninterrupt(0x33);
}

unsigned x = 0,y= 0, button;

void updatestatus()
{
_AX = 3;
geninterrupt(0x33);
x = _CX;
y = _DX;
button = _BX;
}

void main()
{
clrscr();

_setcursortype(_NOCURSOR);

showm();

while(!kbhit())
{
updatestatus();

textcolor(GREEN);
gotoxy(5,2);cprintf("X = %0.2d", (x / 8 +1));
gotoxy(5,3);cprintf("Y = %0.2d", (y / 8 + 1));
gotoxy(5,4);cprintf("Button = %d", button);

}

}

No comments:

Post a Comment