Code Competitions

Coding competition
Showing posts with label operate mouse and restrict mouse area. Show all posts
Showing posts with label operate mouse and restrict mouse area. Show all posts

Tuesday, 14 May 2013

To operate buttons of Mouse and restrict mouse area



#include<dos.h>
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
union REGS in,out;
int callmouse()
{
in.x.ax=1;
int86(51,&in,&out);
return 1;
}
void mpos(int &xpos,int &ypos,int &click)
{
in.x.ax=3;
int86(51,&in,&out);
click=out.x.bx;
xpos=out.x.cx;
ypos=out.x.dx;
}
int mousehide()
{
in.x.ax=2;
int86(51,&in,&out);
}
void setposi(int &xpos,int &ypos)
{
in.x.ax=4;
in.x.cx=xpos;
int86(51,&in,&out);
}
int main()
{
int x,y,cl,a,b;
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
a=100;
b=400;
setposi(a,b);
(a,b);
callmouse();
do
{
mpos(x,4,cl);
gotoxy(10,9);
cout<<"\n*****  possition is  *****\n"<<x<<y;
cout<<"click \n"<<cl;
cout<<"**press any key to hide the mouse**";
}
while(!kbhit());
{
mousehide();
}
cout<<"press any key";
getch();
}

 OUTPUT: