🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #691

Re: Enter To Stop A Program?

#691
From: Marc van den Dikkenberg
Date: Fri, 16 Jul 1999 00:00
34 lines
2424 bytes
On Fri, 16 Jul 1999 10:55:10 -0400, "Tyler" <tkrampe@usa.net> wrote:

>How do you use enter to stop a q-basic program?  Also, how do you use those
>"Keyboard Scan Codes"?  Like if I wanted to end a program with the Ctrl key
>how would I do that?  Thanks in advance.

You can stop a QBasic program with END or SYSTEM

And to end a program by pressing CONTROL, take a look at the following:
(Just remove the lines for the conditions you do not want to check for)

WHILE INKEY$ <> "q"
	DEF SEG = 0
	plop% = PEEK(&H417)
	plop2% = PEEK(&H418)
	IF (plop% AND 2) THEN PRINT "LEFT SHIFT PRESSED"
	IF (plop% AND 1) THEN PRINT "RIGHT SHIFT PRESSED"
	IF (plop% AND 4) THEN PRINT "CONTROL PRESSED"
	IF (plop% AND 8) THEN PRINT "ALT PRESSED"
	IF (plop2% AND 16) THEN PRINT "SCROLL LOCK PRESSED"
	IF (plop2% AND 128) THEN PRINT "INSERT PRESSED"
	IF (plop2% AND 32) THEN PRINT "NUMLOCK PRESSED"
	IF (plop2% AND 64) THEN PRINT "CAPS LOCK PRESSED"
WEND

There are a few things you can check as well, like telling the Left & Right
CTRL/ALT apart, and whether or not CAPSLOCK, NUMLOCK, SCROLLLOCK and INSERT
are turned on...
-- 
Marc van den Dikkenberg
--
The PowerBasic Archives (EU) -- http://www.xs4all.nl/~excel/pb.html
The PowerBasic Archives (US) -- http://www.basicguru.com/dikkenberg
All Basic Code Archives      -- http://come.to/abcpackets
Technical Details
Message-ID: <37948581.5937385@news.xs4all.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <eOHj3.709$Vx2.174281@news.sgi.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10c949,2545da01dfc451c1
X-Google-Attributes: gid10c949,public
X-Google-Thread: f78f1,2545da01dfc451c1
X-Google-Attributes: gidf78f1,public
X-Google-Thread: 10ab99,2545da01dfc451c1
X-Google-Attributes: gid10ab99,public
X-Google-Thread: f5300,2545da01dfc451c1
X-Google-Attributes: gidf5300,public
From: excel@xs4all.nl.REMOVE-THIS (Marc van den Dikkenberg)
Subject: Re: Enter To Stop A Program?
Date: 1999/07/16
Message-ID: <37948581.5937385@news.xs4all.nl>
X-Deja-AN: 501898382
Content-Transfer-Encoding: 7bit
Sender: excel@kvalleyuser071.kvalley.com
References: <eOHj3.709$Vx2.174281@news.sgi.net>
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@xs4all.nl
X-Trace: news1.xs4all.nl 932163154 9023 208.8.155.71 (16 Jul 1999 22:12:34 GMT)
Organization: XS4ALL Internet BV
Mime-Version: 1.0
Reply-To: excel@xs4all.nl.REMOVE-THIS
NNTP-Posting-Date: 16 Jul 1999 22:12:34 GMT
Newsgroups: alt.lang.basic,comp.lang.basic.misc,fj.lang.basic,microsoft.public.basic.dos