BBS: Inland Empire Archive Date: 11-19-92 (04:22) Number: 342 From: WALTON DELL Refer#: NONE To: DAVID KOUTS Recvd: NO Subj: Re: i need some info. Conf: (2) Quik_Bas
-=> Quoting David Kouts to All <=-
DK> I'm kind of an amateur QBASIC programmer who likes to do a
DK> lot with graphics. I'm working on a (kind-of) drawing program, and was
DK> wondering if anyone could tell me how I could get input from a mouse?
DK> What commands would I use?
Here's a very simple paint program:
'This doesn't work with DOS 5 QBasic!
DEFINT A-Z
'$INCLUDE: 'QB.BI' 'do DIR \QB.BI /s if you need path
DECLARE SUB PrintScrn ()
DECLARE SUB MouseNow (leftbutton%, rightbutton%, xmouse%, ymouse%)
DECLARE SUB MouseShow ()
DECLARE SUB MouseHide ()
SUB MouseHide
DIM InRegs AS RegType, OutRegs AS RegType
InRegs.ax = 2
Interrupt 51, InRegs, OutRegs
END SUB
SUB MouseNow (leftbutton%, rightbutton%, xmouse%, ymouse%)
DIM InRegs AS RegType, OutRegs AS RegType
InRegs.ax = 3: leftbutton% = 0: rightbutton% = 0
Interrupt 51, InRegs, OutRegs
IF OutRegs.bx = 1 THEN leftbutton% = -1
IF OutRegs.bx = 2 THEN rightbutton% = -1
IF OutRegs.bx = 3 THEN leftbutton% = -1: rightbutton% = -1
xmouse% = OutRegs.cx: ymouse% = OutRegs.dx
END SUB
SUB MouseShow
DIM InRegs AS RegType, OutRegs AS RegType
InRegs.ax = 1
Interrupt 51, InRegs, OutRegs
END SUB
SUB PrintScrn
DIM InRegs AS RegType, OutRegs AS RegType
Interrupt 5, InRegs, OutRegs
END SUB
SCREEN 0, 0, 0, 0: CLS : COLOR 3: MouseShow
DO
MouseNow Left, Right, x, y
IF Left THEN
MouseHide
LOCATE y, x: PRINT CHR$(219);
MouseShow
ELSEIF Right THEN
MouseHide
LOCATE y, x: PRINT " ";
MouseShow
END IF
KeyPress$ = UCASE$(INKEY$)
IF KeyPress$ = "P" THEN PrintScrn
LOOP UNTIL KeyPress$ = "Q"
MouseHide
END
DK> I'm having to do all my programming on a word-processor and
DK> taking it to my grandparent's house to test it, since this dinky 256k
DK> computer of mine won't run QB. Is there any way I can get QB to run on
DK> this thing?
Not that I know of, but I'd HIGHLY recommend that you either upgrade
your memory, find a cheap (less than $15) XT motherboard (at least) if
you have IBM compatible parts, or buy a whole new system.
Walton Dell
P.S. I love to help beginners.
... Misspelled? No way! I have an error-correcting modem.
Blue Wave/QWK v2.10
--- WM v2.01/92-0162
* Origin: The Huff & Puff BBS (602)-996-0033 USR DS (1:114/144)

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