Posts: 49
Threads: 17
Joined: Jul 2003
I'm busy with this project which was started on a P60 and programmed with QB 4.5 and DirectQB. The problem is that it hangs in Qbasic and as a EXE'cutable on a P3 666 and a AMD XP 2000. If i put a delay in the main loop the program seem to cycle okay but the program doesn't respond anymore from mouse and keyboard input. Can anyone help me with this?
PS: smaller 'demo' kind of programs i wrote does work on the newer pc's.
Posts: 594
Threads: 11
Joined: Oct 2002
What OSs are you using on those newer PCs???
B 4 EVER
Posts: 49
Threads: 17
Joined: Jul 2003
Posts: 6,419
Threads: 74
Joined: Mar 2002
So you know the problem
Posts: 1,845
Threads: 44
Joined: Aug 2002
WinXP sux if you concern programming DOS languages.
Posts: 49
Threads: 17
Joined: Jul 2003
sigh even dosbox (dos emulator) failes (memory error)
still no (easy) solution?
Posts: 594
Threads: 11
Joined: Oct 2002
Posts: 1,272
Threads: 36
Joined: Feb 2003
Don't listen to these people - they're all wrong.
Putting in a delay is the way to go. The reason the keyboard and mouse seem unresponsive isn't Windows' fault - it's because you're not checking the keyboard/mouse while you're in the delay loop!
On a fast computer your program will be spending most of it's time in the delay loop, meaning most of the keystrokes and mouse events happen then, in which case they're ignored completely or aren't processed until it leaves the loop. And that means latency and unresponsiveness.
Good grief guys, I like to rail on Windows as much as the next guy, but this is ridiculous.
Posts: 394
Threads: 16
Joined: Jun 2003
that also means you're using inkey$ instead of inp, doesn't it? since inp keeps the last stroke recorded....
ammit potato!
Posts: 1,272
Threads: 36
Joined: Feb 2003
Quote:that also means you're using inkey$ instead of inp, doesn't it? since inp keeps the last stroke recorded....
Actually INKEY$ does too (but not like the inp method - INKEY$ remembers up to the last 15 keystrokes and gives them to you in order), but DirectQB's INKEY$ replacement doesn't - if that what you mean.
Code:
CLS
PRINT "Press some keys. You have this many seconds left:"
startTime& = INT(TIMER)
DO
d& = INT(TIMER) - startTime&
LOCATE 2, 1: PRINT 10 - d&
LOOP UNTIL d& >= 10
PRINT
PRINT "Here are all the keystrokes in INKEY$'s buffer:"
DO
i$ = INKEY$
PRINT i$,
LOOP WHILE LEN(i$)