home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MSMOUSE1.ZIP / BAS.ZIP / ABSOLUTE.BAS next >
Encoding:
BASIC Source File  |  1989-02-03  |  2.4 KB  |  75 lines

  1.   '******************************************************************
  2.   '*  ABSOLUTE.BAS                                                  *
  3.   '*  6/24/88 by Dave Tryon, Microsoft Product Support              *
  4.   '*                                                                *
  5.   '*  Demonstration of calling mouse functions using CALL ABSOLUTE  *
  6.   '*                                                                *
  7.   '*  Load QB.QLB into memory with QuickBASIC...   QB /L QB.QLB     *
  8.   '*  Assumes EGA - For CGA change SCREEN and LINE statements       *
  9.   '******************************************************************
  10.   
  11.   ' Initialization
  12.     DEFINT A-Z
  13.     DEF SEG = 0
  14.     CLS
  15.   
  16.   ' Get mouse driver vector
  17.     MSEG = 256 * PEEK(51 * 4 + 3) + PEEK(51 * 4 + 2)
  18.     MOUSE = 256 * PEEK(51 * 4 + 1) + PEEK(51 * 4) + 2
  19.   
  20.   ' Proceed if driver found
  21.     IF MSEG OR (MOUSE - 2) THEN
  22.         DEF SEG = MSEG
  23.         IF PEEK(MOUSE - 2) <> 207 THEN
  24.           
  25.             SCREEN 9
  26.           
  27.           ' Function 0  Mouse Reset
  28.             M1 = 0
  29.             CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  30.           
  31.           ' Function 7  Limit Horizontal Motion
  32.             M1 = 7: M3 = 100: M4 = 540
  33.             CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  34.           
  35.           ' Function 8  Limit Vertical Motion
  36.             M1 = 8: M3 = 50: M4 = 300
  37.             CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  38.           
  39.           ' Draw box to show Mouse Motion Range
  40.             COLOR 1
  41.             LINE (100, 50)-(540, 50)
  42.             LINE (540, 50)-(540, 300)
  43.             LINE (540, 300)-(100, 300)
  44.             LINE (100, 300)-(100, 50)
  45.           
  46.           ' Function 1  Show Cursor
  47.             M1 = 1
  48.             CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  49.           
  50.           ' Loop until button pressed
  51.           
  52.             COLOR 7
  53.             M2 = 0
  54.             WHILE (M2 = 0)
  55.               
  56.               ' Function 3  Get Mouse Status
  57.                 M1 = 3
  58.                 CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  59.               
  60.               ' Print Cursor Location
  61.                 LOCATE 2, 2
  62.                 PRINT M3, M4
  63.             WEND
  64.           
  65.           ' Function 0  Reset Mouse and Status
  66.             M1 = 0
  67.             CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
  68.           
  69.         ELSE PRINT "Mouse Driver Not Found.": END
  70.         END IF
  71.       
  72.     ELSE PRINT "Mouse Driver Not Found.": END
  73.     END IF
  74.   
  75.