advr.hlp (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.
INKEY$ Function Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 INKEY$
 
 Usage Notes
   ■ Input from the INKEY$ function cannot be directed to a form. Any
     reference to INKEY$ when forms are showing causes Visual Basic to
     generate an error. Use the HIDE method to hide any visible forms or
     controls before executing this function. See: HIDE Method
 
   ■ The INKEY$ function returns the following values:
 
        Condition                   Value
        ════════════════════════    ════════════════════════════════════════
        If there is no character    Null string
        For keys                    1-byte string containing the character
                                    read
        For extended keys           2-byte string consisting of the null
                                    character (ASCII 0) and keyboard scan
                                    code
 
   ■ The character returned by the INKEY$ function is never displayed on the
     screen; instead, all characters are passed through to the program except
     for the following key combinations:
 
     Character      Visual Basic                 Stand-Alone .EXE File
     ════════════   ══════════════════════════   ═══════════════════════════
     Ctrl+Break     Halts program execution      Halts program execution
                                                 if compiled with /D option;
                                                 otherwise, passed through to
                                                 program
     Ctrl+NumLock   Pauses program execution     Same as running under VBDOS
                    until a key is pressed;      if compiled with /D option;
                    then next key pressed is     otherwise, ignored; the
                    passed through to program    program does not pause and
                                                 no keystroke is passed
     Shift+PrtSc    Prints the screen contents   Prints the screen contents
     Ctrl+Alt+Del   Reboots the system           Reboots the system
 
     See: BC Command-Line Options
 
   ■ If you assign a string to a function key using the KEY statement and you
     press that function key when INKEY$ is waiting for a keystroke, INKEY$
     passes the string to the program. Enabled keystroke trapping takes
     precedence over the INKEY$ function.
 
   ■ When you use INKEY$ with ISAM programs, Visual Basic performs implicit
     CHECKPOINT operations to minimize data loss in the event of a power
     failure. The CHECKPOINT is performed if INKEY$ fails to successfully
     retrieve a character after 65,535 calls, and 20 seconds has expired.
     A CHECKPOINT writes open database buffers to disk.