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

  1. /**
  2. *
  3. * Name        morange -- Set mouse range limits
  4. *
  5. * Synopsis    ercode = morange(option,low,high);
  6. *
  7. *        int ercode      Error return code:
  8. *                  MO_OK if successful;
  9. *                  MO_BAD_OPT if hv not recognized;
  10. *                  MO_ABSENT if mouse not found;
  11. *                  MO_RANGE if low or high is out of range
  12. *                    or if low exceeds high.
  13. *
  14. *        int option      Dimension to limit:
  15. *                  MO_HORIZ to set horizontal limits,
  16. *                  MO_VERT for vertical limits.
  17. *        unsigned low,high Low and high pixel limits.
  18. *
  19. * Description    This function sets the limits for mouse motion in one
  20. *        dimension (horizontal or vertical).
  21. *
  22. *        If the mouse cursor is outside the range limit, the
  23. *        cursor is immediately moved to the nearest location
  24. *        within the limits.
  25. *
  26. * Returns    ercode          Error return code:
  27. *                  MO_OK if successful;
  28. *                  MO_BAD_OPT if hv not recognized;
  29. *                  MO_ABSENT if mouse driver not found;
  30. *                  MO_RANGE if low or high is out of range
  31. *                    or if low exceeds high;
  32. *        b_mouse       Number of mouse buttons (0 if no driver).
  33. *
  34. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  35. *
  36. **/
  37.  
  38. #include <bmouse.h>
  39.  
  40. int morange(option,low,high)
  41. int     option;
  42. unsigned low,high;
  43. {
  44.     DOSREG regs;
  45.  
  46.     switch (option)
  47.     {
  48.     case MO_HORIZ:    regs.ax = 7;          break;
  49.     case MO_VERT:    regs.ax = 8;          break;
  50.     default:    return MO_BAD_OPT;
  51.     }
  52.  
  53.     if (low > high)
  54.     return MO_RANGE;
  55.  
  56.     regs.cx = low;
  57.     regs.dx = high;
  58.     return mogate(®s,®s);
  59. }
  60.