Enable Mouse Pointer in C
by Vinoth[ Edit ] 2008-09-25 16:27:59
Hai,
Run the following code to show mouse pointer using C
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void initmouse();
void initmouse()
{
initgraph(&gd,&m," ");
i.x.ax=1;//show mouse pointer
int86(0x33,&i,&o);
i.x.ax=7;
i.x.cx=0;
i.x.dx=640; //horizontal limite
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=0;
i.x.dx=480;//vertical limite
int86(0x33,&i,&o);
setbkcolor(0);
}
void main()
{
initmouse();
i.x.ax=1; //get mouse position
int86(0x33,&i,&o);
i.x.ax=3; //get mouse position
int86(0x33,&i,&o);
if(o.x.bx==1)//if right clicked
{
printf("right clicked/n");
}
close graph();
}
/*mouse intrrupt number is 0x33
0 is detect mouse
1 is show mouse
2 is hide mouse pointer
3 is get mouse position
4 is set mouse position
5 is get aspect ratio
6 is set aspect ratio
7 is set horizontal limitation
8 is set vertical limitation*/