You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
958 B
C++

Mouse Management functions
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<process.h>
void main(){
clrscr();_setcursortype(_NOCURSOR);
REGS regs;
//Initializing and showing mouse
regs.x.ax=0;int86(0x33,®s,®s);
regs.x.ax=1;int86(0x33,®s,®s);
//Reading mouse click
for( ; ; ){
//Updating mouse motions
regs.x.ax=3;int86(0x33,®s,®s);
//Reading mouse click
if(regs.x.bx==1){
gotoxy(2,2);textbackground(1);textcolor(15);
cprintf("Left Button Clicked!");
delay(100);
}
if(regs.x.bx==2){
gotoxy(2,2);textcolor(15);textbackground(1);
cprintf("Right Button Clicked!");
delay(100);
}
gotoxy(1,2);textbackground(1);cprintf(" ");
//Printing mouse coordinates
gotoxy(1,1);textcolor(11);textbackground(6);
cprintf(" Mouse Position:(%3d,%3d)",regs.x.cx,regs.x.dx);
while(kbhit()){exit(0);}
}
}