Dear programmers
My program compiles fine and runs fine but there are two problems:
When a pressed an key there doesn't response on the pressed key
If I try to quit the application with the escape key it doesn't response
DECLARE EXTERN _sscanf(STRING buf, STRING format,...),INT
DECLARE EXTERN sprintf(POINTER p, POINTER p, ...), INT
DECLARE "kernel32", Sleep(time:int)
CONST BASE_ADDRESS = 0x3F8
CONST DTR = 1
OPENCONSOLE
DEF wTime AS WORD
DEF cKey AS CHAR
DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
UNTIL INKEY$ <> ""
/* Until Keypressed */
UNTIL INKEY$ = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
CLOSECONSOLE
SUB Generator(wImpulstijd AS WORD)
Out32((BASE_ADDRESS + 4), DTR)
Sleep(wImpulstijd)
Out32((BASE_ADDRESS + 4), NOT(DTR))
Sleep(wImpulstijd)
ENDSUB
Can someone help me.
I want no C++ code only EBASIC statements please
See users guide on INKEY$(1)
Paul
I try this but doesn't work:
DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
UNTIL INKEY$(1) <> ""
/* Until Keypressed */
UNTIL INKEY$ = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
I guess you didn't read it or understand it.
UNTIL INKEY$(1) = CHR$(27)
The RAW parameter returns virtual key codes, in otherwords the non printable characters.
Paul
I try this but the loop is endless the outside or the inside loop.
I can quit the program with escape key
OPENCONSOLE
DEF wTime AS WORD
DEF cKey AS CHAR
DO
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
UNTIL INKEY$ <> " "
/* Until Keypressed */
UNTIL INKEY$(1) = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
END
CLOSECONSOLE
Because you don't need two loops.
OPENCONSOLE
DEF wTime AS WORD
DEF cKey AS CHAR
INPUT "Aantal herhalingen 0...65535", wTime
DO
Generator(wTime)
/* Until Keypressed */
UNTIL INKEY$(1) = CHR$(27)
/* cKey := ReadKey */
/* Until cKey = Chr(27) */
END
CLOSECONSOLE
Paul,
Thanks for your solution
I have an other question:
How can I create an function Keypressed() and ReadKey in Ebasic because I have need this in my project or are this replacements in ebasic how can I do this
Thanks