home *** CD-ROM | disk | FTP | other *** search
- '******************************************************************
- '* ABSOLUTE.BAS *
- '* 6/24/88 by Dave Tryon, Microsoft Product Support *
- '* *
- '* Demonstration of calling mouse functions using CALL ABSOLUTE *
- '* *
- '* Load QB.QLB into memory with QuickBASIC... QB /L QB.QLB *
- '* Assumes EGA - For CGA change SCREEN and LINE statements *
- '******************************************************************
-
- ' Initialization
- DEFINT A-Z
- DEF SEG = 0
- CLS
-
- ' Get mouse driver vector
- MSEG = 256 * PEEK(51 * 4 + 3) + PEEK(51 * 4 + 2)
- MOUSE = 256 * PEEK(51 * 4 + 1) + PEEK(51 * 4) + 2
-
- ' Proceed if driver found
- IF MSEG OR (MOUSE - 2) THEN
- DEF SEG = MSEG
- IF PEEK(MOUSE - 2) <> 207 THEN
-
- SCREEN 9
-
- ' Function 0 Mouse Reset
- M1 = 0
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ' Function 7 Limit Horizontal Motion
- M1 = 7: M3 = 100: M4 = 540
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ' Function 8 Limit Vertical Motion
- M1 = 8: M3 = 50: M4 = 300
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ' Draw box to show Mouse Motion Range
- COLOR 1
- LINE (100, 50)-(540, 50)
- LINE (540, 50)-(540, 300)
- LINE (540, 300)-(100, 300)
- LINE (100, 300)-(100, 50)
-
- ' Function 1 Show Cursor
- M1 = 1
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ' Loop until button pressed
-
- COLOR 7
- M2 = 0
- WHILE (M2 = 0)
-
- ' Function 3 Get Mouse Status
- M1 = 3
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ' Print Cursor Location
- LOCATE 2, 2
- PRINT M3, M4
- WEND
-
- ' Function 0 Reset Mouse and Status
- M1 = 0
- CALL ABSOLUTE(M1, M2, M3, M4, MOUSE)
-
- ELSE PRINT "Mouse Driver Not Found.": END
- END IF
-
- ELSE PRINT "Mouse Driver Not Found.": END
- END IF
-
-