BBS: Inland Empire Archive Date: 12-12-92 (06:58) Number: 239 From: RON PIERCE Refer#: NONE To: MIKE JASKO Recvd: NO Subj: pause Conf: (2) Quik_Bas
MJ> I would like to know how to put a simple pause in a QuickBasic
MJ>program. For example, I want it to display a message when the program
MJ>is ending and I want it to stay on the screen for a certin amount of
MJ>time. Thanx in advance!!!
Try the below routine. It is midnight proof. Granted it uses
"TIMER" and thus some floating point, but most programs already have
the float code in there. If need be, you can take "time$" and create
your "own" TIMER-like function (MyTimer) to avoid using timer. What the
hell, I'll include the Mytimer& I use in a few programs. Just CALL the
PAUSE routine like so:
Pause 3 ' (Pauses 3 seconds).
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
DECLARE SUB Pause (NumSecs%)
DECLARE FUNCTION MyTimer&()
FUNCTION MyTimer& STATIC
TempTime$ = Time$
Tempa$ = MID$(TempTime$,4,2)
Tempb$ = MID$(TempTime$,7,2)
' MyTimer& = (QPValL&(TempTime$) * 3600) + QPVali%(Tempa$) * 60 + _
' QPVali%(Tempb$)
MyTimer& = (VAL(TempTime$) * 3600) + VAL(Tempa$) * 60 + VAL(Tempb$)
END FUNCTION
'----------------------
SUB Pause (HowLong%) STATIC
Work& = MyTimer ' TIMER
DO
Work2& = MyTimer ' TIMER
IF Work2& <> Work& THEN
Work& = Work2&
HowLong% = HowLong% - 1
END IF
LOOP UNTIL HowLong% = 0
END SUB
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Ron
* SLMR 2.0 #1376 * Whatever became of the ROCK Band "Cactus" (1970)
--- WM v2.05/92-0545
* Origin: Toast House - (314) 994-0312 - (1:100/560)

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