Monday , December 18 2017
Home / C / Hide Mouse Pointer C Program

Hide Mouse Pointer C Program

How to Hide a Mouse Pointer Program in C : This program will show and hide the mouse pointer after each user input by a key stroke.

Illustration & Example: There are two functions used in the program-

  • showmousepointer(); -> To Show / display the pointerHide Mouse pointer
  • hidemousepointer(); -> to Hide / disappear the pointer


  1. Initialise the Graphics using a graphic driver variable.
  2. Then Check the Mouse Availability. Display error message if not available.
  3. After checking the Mouse use a While Loop to hide and show the Mouse pointer on user input / key stroke using Getch().

Hide/ Disappear Mouse Pointer Program


void showmousepointer();
void hidemousepointer();

union REGS i, o;

int main() {
   int count = 1, gDriver = DETECT, gMode;

   initgraph(&gDriver, &gMode, "C\\:tc\\bgi"); = 0;
   int86(0X33, &i, &o);

   if ( == 0) {
      printf("Mouse Support is Unavailable !!");
   } else {

      while (count <= 10) // This while loop accepts 10 keystrokes or user inputs.
         if (count % 2 == 0) // Mouse Pointer will be hidden on even values
            showmousepointer(); // Mouse Pointer will be show on Odd Values
   return 0;

void showmousepointer() { = 1;
   int86(0X33, &i, &o);

void hidemousepointer() { = 2;
   int86(0X33, &i, &o);

This will check if the mouse driver exists or not.

ax=0x0000ax=0x0000 or 0xFFFF
bx=number of buttons
0x0000 installed
0xFFFF not installed

Int 33,0×01 : Show Mouse cursor


Int 33,0×02 : Hide Mouse Cursor


In and out register must be type of REGS. REGS is a built in UNION declaration in C. It is defined in the dos.h header file

Syntax :

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

Your email address will not be published. Required fields are marked *