home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / MOGATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  1.7 KB  |  73 lines

  1. /**
  2. *
  3. * Name        mogate -- Gateway to Microsoft mouse functions
  4. *
  5. * Synopsis    ercode = mogate(pinregs,poutregs);
  6. *
  7. *        int ercode      Error return code:
  8. *                  MO_OK if successful;
  9. *                  MO_ABSENT if mouse driver not installed.
  10. *        const DOSREG *pinregs
  11. *                  Register values to pass.
  12. *        DOSREG *poutregs  Register values to return.
  13. *
  14. * Description    This function is the gateway to all Microsoft mouse
  15. *        functions.
  16. *
  17. *        Use MOEQUIP or the global variable b_mouse to test for
  18. *        presence of the mouse and mouse driver software.
  19. *
  20. * Returns    ercode          Error return code:
  21. *                  MO_OK if successful;
  22. *                  MO_ABSENT if mouse driver not installed.
  23. *        b_mouse       Number of mouse buttons (0 if no driver).
  24. *
  25. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  26. *
  27. **/
  28.  
  29. #include <dos.h>              /* For int86x(), REGS, SREGS.   */
  30.  
  31. #include <bmouse.h>
  32.  
  33. int mogate(pinregs,poutregs)
  34. const DOSREG *pinregs;
  35. DOSREG         *poutregs;
  36. {
  37.     int      result;
  38.     union  REGS  inregs,outregs;
  39.     struct SREGS sregs;
  40.  
  41.     if (b_mouse == MO_UNKNOWN)
  42.     moequip();
  43.  
  44.     if (b_mouse <= 0)
  45.     result = MO_ABSENT;
  46.     else
  47.     {
  48.     inregs.x.ax = pinregs->ax;
  49.     inregs.x.bx = pinregs->bx;
  50.     inregs.x.cx = pinregs->cx;
  51.     inregs.x.dx = pinregs->dx;
  52.     inregs.x.si = pinregs->si;
  53.     inregs.x.di = pinregs->di;
  54.     sregs.ds    = pinregs->ds;
  55.     sregs.es    = pinregs->es;
  56.  
  57.     int86x(0x33,&inregs,&outregs,&sregs);
  58.  
  59.     poutregs->ax = outregs.x.ax;
  60.     poutregs->bx = outregs.x.bx;
  61.     poutregs->cx = outregs.x.cx;
  62.     poutregs->dx = outregs.x.dx;
  63.     poutregs->si = outregs.x.si;
  64.     poutregs->di = outregs.x.di;
  65.     poutregs->ds = sregs.ds;
  66.     poutregs->es = sregs.es;
  67.  
  68.     result = MO_OK;
  69.     }
  70.  
  71.     return result;
  72. }
  73.