Mouse?

 BBS: Inland Empire Archive
Date: 02-06-93 (18:39)             Number: 352
From: CALVIN FRENCH                Refer#: NONE
  To: GREG DINERT                   Recvd: NO  
Subj: Mouse?                         Conf: (2) Quik_Bas
 On 02-05-93 Greg Dinert wrote to All...

 GD> How do you make a program in QuickBasic that uses a mouse?
 GD> What does it look like? Or can't you? Please help!

Hmm... If you've only Got QBASIC that comes with DOS, it's
pretty pathetic. Otherwise, use Interrupts. Here's my source for
controlling the mouse with QBASIC for DOS:

___-- Use Bean-With-Bacon Can Lid to slice paper -----

' PENTEST.BAS by Calvin French
' Please feel free to copy this program, upload it to any BBS',
' and implement it (if you can) into your programs.
' ----------------------------------------------------------
' When you run this progRam, it will prompt you for a char.
' Enter anything at this prompt. 5 or 6 chars works well,
' though. This will allow you to implement the mouse into
' programs written in the Qbasic that comes with DOS. It will
' not work properly if you have a pen installed. Although
' *BARELY* (and boy, do I ever mean that!) useful, it should
' come in handy if you modify it a bit but more importantly it
' shows you how to do PEN calls to check for the mouse. In
' order to use it you must hold *BOTH* mouse buttons down, and
' it will seem more than choppy. If you are going to use
' graphics modes, change the numbers in the statements:
' Pcol = PEN(8)
' Prow = PEN(9)
'
INPUT "Char? ", char$           'Type in anything
spaces = LEN(char$)             'Needed to erase message
CLS                             'clear screen
ON PEN GOSUB Penit              'Required to use the pen
PEN ON                          'Turn on checking for the pen
Pcol = 10                       'Set original PEN row
Prow = 10                       'Set original PEN colomn
DO                              'Beginning of loop
Penit:                          'Hmmm?!! dunno...
OldPcol = Pcol                  'Set OLD pcol & prow
OldProw = Prow                  ' "   "   "   "   "
Pcol = PEN(8)                   'Get "NEW" pen co-ords
Prow = PEN(9)                   ' "   "   "   "   "
LOCATE OldPcol, OldProw         'set location to where pen WAS
PRINT SPACE$(spaces)            'erase old message
LOCATE Pcol, Prow               'set location to where pen IS
PRINT char$;                    'print message
LOOP WHILE INKEY$ = ""          'restart loop

___-- Use Bean-With-Bacon Can Lid to slice paper -----

Well, hope that helps (ugg - it probably won't, I'm afraid) but
at least you'll learn something from it (hopefully). Stay as
happy as a bean,
- Calvin -

... OFFLINE 1.39 * This isn't a tagline... Ha ha! Fooled you!

--- Maximus 2.01wb
 * Origin: RJ's Byteline =[HST/DS]= Calgary (403)247-3180 CANADA (1:134/75)
Outer Court
Echo Basic Postings

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