BBS: Inland Empire Archive Date: 07-24-92 (23:40) Number: 161 From: MATT HART Refer#: NONE To: BRANDON CALLISON Recvd: NO Subj: Mouse Routines Conf: (2) Quik_Bas
BC> Can anyone tell me how to use a mouse in QuickBasic
' HSMOUSE.BAS by Matt E. Hart
'
' Uses Int 33h calls to operate the mouse.
' Note that this is NOT a complete reference, get the
' Microsoft Mouse Programmer's Guide at your local
' bookstore.
'
DEFINT A-Z
'$INCLUDE:'QB.BI'
DECLARE SUB MouseShow
DECLARE SUB MouseHide
DECLARE FUNCTION MouseInit
DECLARE FUNCTION MouseLeftButton
DECLARE FUNCTION MouseRightButton
DIM SHARED InRegs AS RegTypeX
DIM SHARED OutRegs AS RegTypeX
CLS
MouseThere = MouseInit
IF MouseThere THEN
MouseShow
DO
LOOP UNTIL MouseLeftButton
MouseHide
ENDIF
END
FUNCTION MouseInit
InRegs.AX = 0
CALL InterruptX(&H33,InRegs,OutRegs)
MouseInit = OutRegs.AX
END FUNCTION
SUB MouseShow
InRegs.AX = 1
CALL InterruptX(&H33,InRegs,OutRegs)
END SUB
FUNCTION MouseLeftButton
InRegs.AX = 5
InRegs.BX = 0
CALL InterruptX(&H33,InRegs,OutRegs)
MouseLeftButton = (OutRegs.AX = 1)
END FUNCTION
FUNCTION MouseRightButton
InRegs.AX = 5
InRegs.BX = 1
CALL InterruptX(&H33,InRegs,OutRegs)
MouseRightButton = (OutRegs.AX = 1)
END FUNCTION
SUB MouseHide
InRegs.AX = 2
CALL InterruptX(&H33,InRegs,OutRegs)
END SUB
---
* Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET