I wrote this a few years ago for some students to perform mouse functions without QB45. I like to start with this program TEMPLATE.BAS and rename it when starting new projects. Copy the following program and save it to a file called template.bas. Run the program and move the mouse. Have fun!
'***********************************************************
'
' T E M P L A T E . B A S - Written by Chuck B, May 1998
'
' email: cbolin@dycon.com
' This file contains mouse controls as well as few DOS interrupts.
'
'***********************************************************
DECLARE FUNCTION DOSInterupt% (intINT AS INTEGER, intAX AS INTEGER, intBX AS INTEGER, intCX AS INTEGER, intDX AS INTEGER)
DECLARE FUNCTION GetFreeDiskSpace& (intDX%)
DECLARE FUNCTION GetDOSVersion! ()
DECLARE SUB WarmBoot ()
DECLARE SUB CenterText (strText AS STRING, intRow AS INTEGER, intFColor AS INTEGER, intBColor AS INTEGER)
DECLARE SUB DisableMouse ()
DECLARE SUB EnableMouse ()
DECLARE SUB ReadMousePosition ()
DECLARE SUB ShowMouseCursor ()
DECLARE SUB HideMouseCursor ()
DECLARE SUB SetMouseYLimits (intMaxY%, intMinY%)
DECLARE SUB SetMouseXLimits (intMaxX%, intMinX%)
DECLARE SUB SetMousePosition (intX%, intY%)
DIM SHARED aASM(50) AS INTEGER
DIM SHARED intReturn AS INTEGER
DIM SHARED lngFreeBytes AS LONG
DIM SHARED strDOSVersion AS STRING
DIM SHARED lngReturn AS LONG
DIM SHARED intMB AS INTEGER
DIM SHARED intMX AS INTEGER
DIM SHARED intMY AS INTEGER
DIM strByte AS STRING
DIM strKey AS STRING
DIM strLeft AS STRING
DIM strRight AS STRING
DIM strUp AS STRING
DIM strDown AS STRING
DIM strPgUp AS STRING
DIM strPgDown AS STRING
DIM strHome AS STRING
DIM strEnd AS STRING
DIM strEsc AS STRING
strLeft = CHR$(0) + "K"
strRight = CHR$(0) + "M"
strUp = CHR$(0) + "H"
strDown = CHR$(0) + "P"
strPgUp = CHR$(0) + "I"
strPgDown = CHR$(0) + "Q"
strHome = CHR$(0) + "G"
strEnd = CHR$(0) + "O"
strEsc = CHR$(27)
'loads assembler routine into aASM() array
DEF SEG = VARSEG(aASM(0))
FOR x = 0 TO 50
READ strByte
POKE VARPTR(aASM(0)) + x, VAL("&H" + strByte)
NEXT x
'initialization
SCREEN 12
CLS
EnableMouse
ShowMouseCursor
SetMousePosition 20, 200
SetMouseXLimits 20, 3160
SetMouseYLimits 20, 200
'main control loop
DO
strKey = INKEY$
ReadMousePosition
LOCATE 5, 10: PRINT intMX
LOCATE 5, 20: PRINT intMY
LOCATE 5, 30: PRINT intMB
'left mouse button
IF intMB = 1 THEN
END IF
'right mouse button
IF intMB = 2 THEN
END IF
'middle mouse button
IF intMB = 4 THEN
END IF
'waits for D key
IF UCASE$(strKey) = "D" THEN
SHELL
END IF
'left cursor
IF strKey = strLeft THEN
END IF
IF strKey = strRight THEN
END IF
IF strKey = strUp THEN
END IF
IF strKey = strDown THEN
END IF
IF strKey = strPgUp THEN
END IF
IF strKey = strPgDown THEN
END IF
IF strKey = strHome THEN
END IF
IF strKey = strEnd THEN
END IF
LOOP UNTIL strKey = strEsc
END
'************************************************************
' A S S E M B L E R C O D E
' Reference: Que's 'DOS Programmers Reference - 4th Edition'
' Waite Group's 'Microsoft Quickbasic Bible'
' Osborne 'Assembler - Inside & Out'
'************************************************************
DATA 55
DATA 8b,ec
DATA 56
DATA 57
DATA 8b,76,0c
DATA 8b,04
DATA 8b,76,0a
DATA 8b,1c
DATA 8b,76,08
DATA 8b,0c
DATA 8b,76,06
DATA 8b,14
DATA cd,21
DATA 8b,76,0c
DATA 89,04
DATA 8b,76,0a
DATA 89,1c
DATA 8b,76,08
DATA 89,0c
DATA 8b,76,06
DATA 89,14
DATA 5f
DATA 5e
DATA 5d
DATA ca,08,00
FUNCTION DOSInterupt% (intINT AS INTEGER, intAX AS INTEGER, intBX AS INTEGER, intCX AS INTEGER, intDX AS INTEGER)
DEF SEG = VARSEG(aASM(0))
POKE VARPTR(aASM(0)) + 26, intINT
CALL absolute(intAX, intBX, intCX, intDX, VARPTR(aASM(0)))
DOSInterupt% = intAX
END FUNCTION
SUB EnableMouse
intReturn = DOSInterupt%(&H33, 0, intBX%, intCX%, intDX%)
END SUB
SUB HideMouseCursor
intReturn = DOSInterupt%(&H33, 2, intBX%, intCX%, intDX%)
END SUB
SUB ReadMousePosition
intReturn = DOSInterupt%(&H33, 3, intMB, intMX, intMY)
END SUB
SUB SetMousePosition (intX%, intY%)
intReturn = DOSInterupt%(&H33, 4, intBX%, intX%, intY%)
END SUB
SUB SetMouseXLimits (intMaxX%, intMinX%)
intReturn = DOSInterupt%(&H33, 7, intBX%, intMinX%, intMaxX%)
END SUB
SUB SetMouseYLimits (intMaxY%, intMinY%)
intReturn = DOSInterupt%(&H33, 8, intBX%, intMinY%, intMaxY%)
END SUB
SUB ShowMouseCursor
intReturn = DOSInterupt%(&H33, 1, intBX%, intCX%, intDX%)
END SUB