home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 354_01 / mustest.c < prev    next >
Text File  |  1991-06-14  |  2KB  |  90 lines

  1. #include <conio.h>
  2. #include <stdlib.h>
  3. #include <cesmouse.h>
  4.  
  5. int lft,ctr,rgt,mx,my,but,nb;
  6.  
  7. main()
  8.  
  9. {
  10.     clrscr();
  11.  
  12.     printf("CES Mouse Library Test\n");
  13.     printf("Press Any Key to Exit\n\n");
  14.  
  15.     /* Check for the Mouse Driver */
  16.  
  17.     if (mousedrvr() == 0)
  18.       {
  19.           printf("Mouse Driver Not Installed\n\n");
  20.           exit(1);
  21.       }
  22.  
  23.     /* Reset the mouse.. All registers to '0'  */
  24.  
  25.    nb = resetmouse();
  26.    printf("Number of mouse buttons: %d",nb);
  27.  
  28.     /* Position the Mouse */
  29.     posmouse(320,96);
  30.  
  31.     /* Show the Mouse */
  32.     showmouse();
  33.  
  34.  
  35.     gotoxy(30,8);
  36.     cprintf("Button Values: ");
  37.     gotoxy(30,10);
  38.     cprintf("Left Button: ");
  39.     gotoxy(30,11);
  40.     cprintf("Middle Button: ");
  41.     gotoxy(30,12);
  42.     cprintf("Right Button: ");
  43.     gotoxy(30,14);
  44.     cprintf("X Value: ");
  45.     gotoxy(30,15);
  46.     cprintf("Y Value: ");
  47.  
  48.     /* Output Mouse Button Values */
  49.  
  50.     for(;;)
  51.         {
  52.         lft = lftbutton();
  53.         ctr = ctrbutton();
  54.         rgt = rgtbutton();
  55.         mx = mousecursX();
  56.         my = mousecursY();
  57.         but = buttons();
  58.  
  59.             gotoxy(46,8);
  60.             cprintf("%d",but);
  61.             gotoxy(46,10);
  62.             cprintf("%d",lft);
  63.             gotoxy(46,11);
  64.             cprintf("%d",ctr);
  65.             gotoxy(46,12);
  66.             cprintf("%d",rgt);
  67.             gotoxy(46,14);
  68.             cprintf("    ");
  69.             gotoxy(46,14);
  70.             cprintf("%d",mx);
  71.             gotoxy(46,15);
  72.             cprintf("    ");
  73.             gotoxy(46,15);
  74.             cprintf("%d",my);
  75.  
  76.  
  77.         if (kbhit()) break;
  78.         }
  79.  
  80.     /* Hide the Mouse */
  81.     hidemouse();
  82.  
  83.     /* Reset the Mouse */
  84.     nb = resetmouse();
  85.  
  86.  
  87.     exit(0);
  88.  
  89. }
  90.