About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Tuesday, September 3, 2013

C Program to check if mouse support is available or not.

#include<stdio.h>
#include<conio.h>
#include<dos.h>

int initmouse();

union REGS i, o;

int main()
{
   int flag;

   flag = initmouse();

   if ( flag == 0 )
      printf("\nMouse support not available.");
   else
      printf("\nMouse support available.");

   getch();
   return 0;
}

int initmouse()
{
   i.x.ax = 0;
   int86(0X33,&i,&o);
   return ( o.x.ax );
}
Output :
Mouse support available.

Explanation :
[arrowlist]
  • Int86() is a C function that allows to call interrupts in the C program
  • Header File : dos.h
[/arrowlist]
Usage is int86 (int intr num, union REGS *inregs,
                                  union REGS *outregs)
[arrowlist]
  • In and out register must be type of REGS.
  • REGS is a built in UNION declaration in C.
  • It is defined in the header file
[/arrowlist]

No comments: