home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
KB-INKEY.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
3KB
|
55 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME KB-INKEY.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC"
COLOR 7, 0
CLS
? "┌────────────────────────────────────────────────────────────────────
? "│ fINKEY% ( ScanCode?, AsciCode? )
? "│ fINSTAT% ( ScanCode?, AsciCode? )
? "├───────────────────────────────────────────────────────────────────────
? "│ There are times when it is preferable to know which of the keys were
? "│ pressed and not just the ASCII value that was stuffed into the buffer.
? "│ Little things like non-English keyboard drivers may think that the Z key
? "│ really should send a Y or some such thing! But, by working with the
? "│ keyboard's scan codes you can tell actually WHICH key was pressed so your
? "│ program can determine the proper course of action.
? "│ As you work the short program, below, watch the values returned for the
? "│ function keys, arrow keys, etc. they may just look familiar!
? "├─────────────────────────────────────────────────────────────────────────
? "│ OH! almost forgot... fINSTAT% reads the keyboard buffer but does
? "│ NOT remove any key press found there.
? "│ BOTH return 0 if no key press was present
? "│ and -1 if there was.
? "└─────────────────────────────────────────────────────────────────────────
? " PRESS <ESC> TO END THE PROGRAM"
?
'┌───────────────────────────
ClearKeyboard '│ for you F.T.L. types
DO '│
WHILE NOT fINKEY%( SCode?, ACode? ) : WEND '│ wait for a key press
PRINT USING "ScanCode: ### "; Scode?; '│ print SCANCODE
PRINT USING "ASCIIcode: ### "; ACode? '│ print ASCII VALUE
LOOP UNTIL Acode? = 27 '│ loop until <ESC> is pressed
'│
PRINT "<< THANK YOU >>" '│ Mom said to be polite!
'└───────────────────────────