-->
Showing posts with label Program to show pointer of mouse(text and graphics mode). Show all posts
Showing posts with label Program to show pointer of mouse(text and graphics mode). Show all posts

Program to show pointer of mouse(text and graphics mode)

using turboc++
-----------------------------------------------------------------
//program to activate/detection mouse
#include <dos.h>
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
union REGS in_put, out_put;// input and output variables stored in union
  //input for signal detection;output for screen display
void showmouse()

{
 //in_put.x.ax = 1;// taking value 1 for display of mouse on screen  in text mode
 //int86 (0X33,&in_put,&out_put);//invoking interrupt
 //if we want to display mouse in graphics mode then
 //we put following code
 int gdriver=DETECT,gmode;  //graphics detection
 initgraph(&gdriver,&gmode,"c:\\tc\\bgi"); //graphics initialization
 in_put.x.ax = 1;// ax is register used for mouse .1 is used to display mouse
 int86 (0X33,&in_put,&out_put);   //invokes interrupt using 0X33; for mouse, it is 0X33
 getch();
 closegraph();   //graphics closing.
}
int main ()
{

showmouse();//calling of function
getch ();
return 0;
}

//note:If you want to use mouse in text mode, uncomment the commented lines
//in showmouse() function.
//we can also put mouse initialization part here.