home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_08 / 9n08041a < prev    next >
Text File  |  1991-04-23  |  1KB  |  66 lines

  1.  
  2. /* Simple mouse package.
  3.    Copyright 1991 Dave Newman.
  4.    Use for any purpose permitted as long
  5.    as this copyright notice is included.*/
  6. #include <dos.h>
  7.  
  8. int mouse_init()
  9.    {
  10.    union REGS regs;
  11.    /* initialize mouse */
  12.    regs.x.ax = 0;
  13.    int86(0x33,®s,®s);
  14.    return(regs.x.ax);
  15.    }
  16.  
  17. void mouse_cursor(int value)
  18.    {
  19.    union REGS regs;
  20.    /* turn mouse cursor on (1) or off (0) */
  21.    if(value)
  22.       regs.x.ax = 1;
  23.    else
  24.       regs.x.ax = 2;
  25.    int86(0x33,®s,®s);
  26.    }
  27.  
  28. void mouse_set_cursor(int x,int y)
  29.    {
  30.    union REGS regs;
  31.    /* set mouse cursor to x,y position */
  32.    regs.x.ax = 4;
  33.    regs.x.cx = x;
  34.    regs.x.dx = y;
  35.    int86(0x33,®s,®s);
  36.    }
  37.  
  38. void mouse_status(int *binfo,int *xinfo,int *yinfo)
  39.    {
  40.    union REGS regs;
  41.    /* get mouse information on buttons
  42.       being pressed and x,y position */
  43.    regs.x.ax = 3;
  44.    int86(0x33,®s,®s);
  45.    *binfo = regs.x.bx;
  46.    *xinfo = regs.x.cx;
  47.    *yinfo = regs.x.dx;
  48.    }
  49.  
  50. void mouse_text_cursor(int backround,int foreground)
  51.    {
  52.    union REGS regs;
  53.    /* design text mouse cursor,
  54.       similar to normal cursor */
  55.    regs.x.ax = 10;
  56.    regs.x.bx = 0;      /* software cursor */
  57.  
  58.    /* set backround color of mouse cursor */
  59.    regs.x.cx = backround;
  60.  
  61.    /* set lines of cursor FFFF == Block */
  62.    regs.x.dx = foreground;
  63.    int86(0x33,®s,®s);
  64.    }
  65.  
  66.