overview.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
About the Keyboard (1.2)
Using Section  Function Group                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
                             About the Keyboard
 
The keyboard functions give programs direct access to the system keyboard.
Programs can read individual keystrokes from a keyboard, or they can read
complete strings. Keystroke information includes the character value, the
scan code for the key, and the status of the keyboard, such as the state of
the shift keys.
 
MS OS/2 stores each keystroke in an input buffer for the keyboard. A program
can then use the KbdCharIn or KbdStringIn function to read the next
keystroke from the buffer and copy it to a specified structure or buffer. A
program can also use the KbdPeek function to look at the next character in
the buffer without removing it or use the KbdFlushBuffer function to flush
the contents of the buffer.
 
The keyboard functions require a keyboard handle that identifies the
keyboard to read from or modify. A program can always use keyboard handle 0
to read from the system keyboard. However, if more than one process (or
thread) in the same screen group attempts to read from the system keyboard
at the same time, there is no guarantee that the correct process will
receive the keystrokes. To prevent these conflicts, a program can create a
logical keyboard by using the KbdOpen function. A logical keyboard receives
no keyboard input until a process obtains the keyboard focus for it by using
the KbdGetFocus function. Only the logical keyboard that has the focus can
receive input.
 
The keyboard status defines how the keyboard operates. A program can change
this status by using the KbdSetStatus function. Two important features of
the status are echo mode and input mode. If echo mode is on, characters are
displayed on the screen as they are typed; otherwise, they are not
displayed. Input mode specifies whether MS OS/2 control and editing keys are
processed when characters are typed. Input mode can be ASCII (cooked) or
binary (raw). In ASCII mode, all MS OS/2 control and editing keys, such as
CTRL+C and F3, are processed when the program reads characters by using the
KbdStringIn function, and all MS OS/2 control keys are processed when the
program reads keystrokes by using the KbdCharIn function. In binary mode,
only the CTRL+BREAK key combination is processed in either case.
 
The following key combinations are MS OS/2 control keys:
 
  CTRL+BREAK
  CTRL+C
  CTRL+H
  CTRL+J
  CTRL+P
  CTRL+S
  CTRL+Z
 
The following are MS OS/2 editing keys:
 
  BKSP
  DEL
  ESC
  F1
  F2
  F3
  F4
  F5
  INS
 
Other keyboard functions carry out such special tasks as adapting the
keyboard to receive country-specific information or modifying the operation
of one or more of the keyboard functions.
 
 
                                      ♦