#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
#include<dos.h>
union REGS i,o;
void showpointer();
void hidepointer();
int init_mouse();
int main()
{
int gd=DETECT,gm,status;
initgraph(&gd,&gm,"C:\\turboc3\\bgi");
status = init_mouse();
if(status==0)
{
outtextxy(200,240,"NO MOUSE SUPPORT.");
}
else
{
while(1)
{
char opt;
cleardevice();
cout<<"\n1.Press s to show pointer\n2.Press h to hide pointer\n3.Press any key to exit\n";
cout<<"\nEnter the option : ";
//take user input
opt=getch();
if(opt == 's')
showpointer();
else if (opt == 'h')
hidepointer();
//hides the pointer
else
break;
}
}
closegraph();
return 0;
}
void showpointer()
{
i.x.ax=1;
int86(0X33,&i,&o);
}
void hidepointer()
{
i.x.ax=2;
int86(0X33,&i,&o);
}
int init_mouse()
{
i.x.ax = 0;
int86(0X33,&i,&o);
return(o.x.ax);
}
No comments:
Post a Comment