[comp.lang.pascal] checking IBM keyboards, etc.

lihan@walt.cc.utexas.edu (Bruce Bostwick) (02/22/90)

I am in need of a set of functions that can check the CapsLock, NumLock,
and ScrollLock keys on an IBM-compatible keyboard.  I have found no way
to read these easily and would like to see other people's attempts if
possible, in order to avoid duplicating effort.  I have some requirements:

1) These must be functions that do not require arguments and return only
   a boolean value indicating the state of the key.  If this is impossible
   or inefficient, an alternative might be to have one function return a
   code with values corresponding to various combinations of keys; however,
   I would prefer the first.

2) The code must be well-behaved enough to be portable.  This would seem to
   mean 'call the BIOS' or some other machine-independent method.

3) If it is glaringly obvious (sorry, I'm not terribly used to DOS yet) how
   this is done, the 'guts' of the algorithm will be fine as long as I can
   build a set of functions around them.

I would appreciate not being flamed for my ignorance.  I have only recently
become involved with DOS machines, and am consequently only marginally
familiar with their hardware interface.  I have tracked down how to read
the keyboard as separate key events, but the 'Lock' keys elude me due to
their being processed directly by the keyboard service routines so TP
never sees them via   read(kbd,kbchar);   or such like.

Thank you for your patience.


===============================================================================
Internet:  lihan@vondrake.cc.utexas.edu   :-) aka BB/CIV (-:
BellNet:   (512)346-2744
SlowNet:   varies chaotically, e-mail for current value

nothing cute to say or disclaim -- sorry...
===============================================================================