既然楼上的已经解释了,那么我就放一个鼠标的操作是自己做的:
#include <stdio.h>
#include <dos.h>
void initMouse()
{union REGS reg;
reg.x.ax=0;int86(0x33,®,®);
if(reg.x.ax!=0xffff)
printf ("Mouse Driver not detected. ");
reg.x.ax=1;int86(0x33,®,®);
}
void getMouse(int *x,int *y,int *button)
{ union REGS reg;
reg.x.ax=3; int86(0x33,®,®);
*x=reg.x.cx ;
*y=reg.x.dx ;
*button=reg.x.bx ;
}
void hideMouse()
{ union REGS reg;
reg.x.ax=2; int86(0x33,®,®);
}
main()
{
int x,y,z;
clrscr();
initMouse();
while(!kbhit())
{
getMouse(&x,&y,&z);
gotoxy(1,1);
printf("\rMouse virtual co-ords=\t%d,\t%d",x,y);
gotoxy(1,2);
printf(" buttons value =%1d",z);
}
hideMouse();
}