read keyboard input b4 windows does
read keyboard input b4 windows does
(OP)
Is there a way to read the keyboard input b4 it passes thru windows and then to DOS. Maybe by using the BIOS or something. I either just want to read it or disrupt it so that it doesn't get to windows and perform functions. like the windows key or ctrl-alt-del. Any help would be great thx.
RE: read keyboard input b4 windows does
Which reads the keyboard port...
this can get tricky...
to learn more about this, you can use a simple program like this...
Do
Locate 1:Print "Scan Code: "; Inp(96)
Loop Until Inp(96) = 1
this will loop until Esc is pressed and show the current scan code on the screen...
take note of what codes it returns when you press keys, release them, and when you hold keys down while pressing other keys, and release them in different orders...
(or just do a search on Inp(96) or Inp(&h60), there are many tutorials out there...)
Have Fun, Be Young... Code BASIC

-Josh
http://cubee.topcities.com
RE: read keyboard input b4 windows does
RE: read keyboard input b4 windows does
Inkey$, Input, and Input$(x) are all processed comands...
Meaning They go through Dos / Windows and Qbasic to process the output to return characters and formated data...
INP(96) reads the keyboard port directly (or very close to that)
Windows / Dos might have a hand in routing you to and from the port, but the data is unprocessed, and is rerturned MUCH faster...
However, you must then process it your self...
On the upside, It will unlock the ability to alow Multi-Key programs and know if a Key is Pressed, Held Down, and Released...
If you Want your program to pause or loop until you press a key, you can do this...
K = INP(96) 'read the current Key Status
Do
'optional code here
LOOP UNTIL INP(96) <> K 'Loop until the status changes...
The more traditional way is to use Input$(1) or Inkey$
This will Freeze your program until you press 1 key
A$ = Input$(1)
Which, is fine, if you don't want anything to happen while the program is waiting you input...
This will also Loop until a key is Pressed...
Do
'optional code here
Loop Until Inkey$<>""
This is OK, and I used this method for years, but now I have a 2GHz processor, and after 5 seconds of looping with no input, the program speed slows down by approx 50% (until I move the Mouse or something) which is NOT A GOOD THING. So the solution resulted in using INP(96) to read the KB Port so you don't have to wait for QB to process the Inkey$ command (or whatever it does to slam your program speed)...
If you can't find help on INP(96) aka INP(&h60), let me know and I will provide detailed information and a few Tips to increase it's usability and improve it's performance...
Good Luck,
J S
Have Fun, Be Young... Code BASIC

-Josh
http://cubee.topcities.com
RE: read keyboard input b4 windows does
FAQ314-4291 is a multikey routine, it uses assembly to read from the keyboard. Its a lot smoother than INP(96), but it repeats instantly without a pause, you will have to work that in yourself (if you want it).
RE: read keyboard input b4 windows does
To disable Crtl-Alt-Delete, etc... try the following code from...
http://www.phys.uu.nl/~bergmann/basic-faq.html#break
This is done using the ON KEY x GOSUB statement, like this:
KEY 15, CHR$(&H04) + CHR$(70) 'CTRL-BREAK
KEY 16, CHR$(&H04) + CHR$(&H08) + CHR$(83) 'CTRL-ALT-DEL
ON KEY (15) GOSUB 100
ON KEY (16) GOSUB 200
DO
...
LOOP
100 PRINT "CTRL-BREAK pressed."
RETURN
200 PRINT "CTRL-ALT-DEL pressed."
RETURN
------------------------------------
If that does not work... try this (same site)
Another way of disabling CTRL-BREAK is as follows:
' DISABLE CTRL-BREAK:
dim brk$(3)
' First save the current vectors:
def seg=0: for i=108 to 111: brk$(i-108)=str$(peek(i)): next
' Then poke new interrupt vectors:
poke 108,83: poke 109,255: poke 110,0: poke 111,240: def seg
' RESTORE CTRL-BREAK:
def seg=0: for i=108 to 111: poke i,val(brk$(i-108)): next: def seg
If all else fails, Google:
Disable Ctrl Alt Delete Qbasic
Have Fun, Be Young... Code BASIC

-Josh
http://cubee.topcities.com
RE: read keyboard input b4 windows does
won't monitor it either. I was thinking that windows has some kind of dll to monitor the keyboard or something. I just wanted to know if there was a way to monitor the keyboard like windows does.
RE: read keyboard input b4 windows does
RE: read keyboard input b4 windows does
That IS the keyboard input port...
And is the way the keyboard directly interfaces with rest of the computer...
The reason Qbasic's version of this is So slow compared to assembly, etc... is that QBASIC IS SLOW...
But the only way to directly acces the keyboard (for input) is Port 96 (no matter what method you use to do it...)
I believe there is a way (another port or something) to to send keys to the Keyboard buffer..., but I don't remember what they are...
Have Fun, Be Young... Code BASIC

-Josh
http://cubee.topcities.com
RE: read keyboard input b4 windows does
RE: read keyboard input b4 windows does
The multikey routine i directed you to disables every button on the keyboard (Including PRTSCRN and CTRL-BREAK) but doesn't diable any windows combinations (CTRL-ALT-DEL, ALT-TAB...), but if I wanted to make those combinations do something, I could.
RE: read keyboard input b4 windows does
RE: read keyboard input b4 windows does
RE: read keyboard input b4 windows does
For exmple when I push the windows key it gives the code 92 an then it keeps changing. It alternates between 92 and 224 if you hold it down. the same thing happens with the ctrl, arrow keys, etc... And one time is sorta froze input from the keyboard. It wouldn't let me turn caps lock on and off and when I pushed a key it qbasic would read it as a different key. Then one time it held shift down even though i was pushing it. I thought all that was pretty odd, but at least I know how to read the windows key. I just gotta kill windows cause it doesn't deserve to live and run in pure dos cause windows is pure evil. But a lot weird things hapenned in pure dos
RE: read keyboard input b4 windows does
"Quotes are cool because they're all quote-like" My quote
RE: read keyboard input b4 windows does