Tuesday, September 18, 2012

Code#102:C Program to hide mouse pointer

| |

Basic C Language Program  to hide mouse pointer  is explained below with a detailed explanation,you will find it easy to go through this program, Sample input and output screen shots has been provide for the better understandability to the user, leave a comment if you are satisfied with the code
                                       Click Read more for the code


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

int initmouse();
void showmouseptr();
void hidemouseptr();

union REGS i, o;

main()
{
   int status, count = 1, gd = DETECT, gm;

   initgraph(&gd,&gm,"C:\\TC\\BGI");

   status = initmouse();

   if ( status == 0 )
      printf("Mouse support not available.\n");
   else
   {
      showmouseptr();

      while(count<=10)
      {
         getch();
         count++;
         if(count%2==0)
            hidemouseptr();
         else
            showmouseptr();
      }
   }

   getch();
   return 0;
}

int initmouse()
{
   i.x.ax = 0;
   int86(0X33,&i,&o);
   return ( o.x.ax );
}

void showmouseptr()
{
   i.x.ax = 1;
   int86(0X33,&i,&o);
}

void hidemouseptr()
{
   i.x.ax = 2;             // to hide mouse
   int86(0X33,&i,&o);
}

0 comments:

Post a Comment

Powered by Blogger.