/
MOUSED~1.C
55 lines (53 loc) · 896 Bytes
/
MOUSED~1.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
union REGS in,out;
int callmouse()
{ in.x.ax=1;
int86(51,&in,&out);
return 1;
}
void mouseposi(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);
return 1;
}
void setposi(int *xpos,int *ypos)
{
in.x.ax=4;
in.x.cx=*xpos;
in.x.dx=*ypos;
int86(51,&in,&out);
}
int main()
{
int x,y,cl,a,b;
int g=DETECT,m;
initgraph(&g,&m,"..\\bgi");
cleardevice();
a=100;
b=400;
setposi(&a,&b);
callmouse();
do
{
mouseposi(&x,&y,&cl);
gotoxy(10,9);
printf("\n\tMouse Position is: %d,%d",x,y);
printf("\n\tClick: %d",cl);
printf("\n\tPress any key to hide the mouse");
}while(!kbhit());
getch();
mousehide();
printf("\n\n\tPress any key to Exit");
getch();
return 1;
}