Version 3 Technical Highlights - KBStatus
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 OCT 1992 | 3.0+ | EXPERT | KBSTATUS |
A function which returns an integer which indicates which special keyboard keys are pressed down at the time that the routine is called. To find out whether a particular key is active it is necessary to BITAND the result with a specific integer as shown in the following table. If the BITAND returns false then the key is not pressed.
1 | The Right Shift key |
2 | The Left Shift Key |
3 | Left/Right Shift |
4 | The Ctrl Key |
8 | The Alt Key |
16 | The Scroll Lock Key |
32 | The Num Lock Key |
64 | The Caps Lock Key |
128 | Insert Key |
Thus to check whether the user was pressing Right-Shifted-Alt the following code segment would suffice
Declare Function KbStatus Loop Input X,-1 Until X = \1B\ If BitAnd(KbStatus(),1) Then If BitAnd(KbStatus(),8) Then Print Char(7) : End End Repeat
(Volume 4, Issue 5, Pages 11,12)