home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_05 / 2n05043a < prev    next >
Text File  |  1991-03-27  |  999b  |  43 lines

  1.  
  2. /*
  3.     TITLE:      Test Driver for MouseLib Module;
  4.     FILENAME:   TRYMOUSE.C;
  5.     COMPILER:   Turbo C++ V.1.0;
  6.     REQUIRES:   MOUSELIB.OBJ;
  7. */
  8.  
  9.  
  10. #include <stdio.h>
  11. #include <dos.h>
  12. #include <conio.h>
  13. #include "mouselib.h"
  14.  
  15. int mou_buttons;
  16. unsigned long far *mouse_vector = (unsigned long far *) MK_FP(0, 0x33 * 4);
  17.  
  18. int main(void)
  19. {
  20.     int x, y, count, button = 1;
  21.     unsigned char far *op_code = (unsigned char far *) *mouse_vector;
  22.  
  23.     clrscr();
  24.  
  25.     if(! op_code  ||  *op_code == 0xCF)  /* if vector NULL or has IRET opcode */
  26.     goto bail_out;                   /* don't bother to call INT 33h! */
  27.  
  28.     if(! mouse_reset(&mou_buttons))  {
  29. bail_out:
  30.     printf("\n\tNo Mouse!\n");
  31.     return 1;
  32.     }
  33.  
  34.     printf("\n\n\tPress Right Mouse Button to Quit ...\n\n");
  35.     mouse_show();
  36.     while(! (mouse_button_press(&x, &y, &count, button) & RIGHT_BUTTON))
  37.     ;   /* do nothing */
  38.  
  39.     mouse_hide();
  40.     mouse_reset(&mou_buttons);
  41.     return 0;
  42. }
  43.