Q63781: INKEY$ Fails with Various CTRL, ALT Key Combinations QB 4.00
Article: Q63781
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | buglist4.00 buglist4.00b buglist4.50 B_BasicCom SR# S900706- | mspl13_basic
Last Modified: 13-JUL-1990
The INKEY$ statement fails to return any value with certain CTRL and
ALT key combinations that should return extended (2-byte) codes. The
table below lists the keys that fail to return values:
CTRL+ ALT+
----- ----
TAB ` (back apostrophe)
INS (INSert) BACKSPACE
DEL (DELete) TAB
Keypad 5 [ and ]
Keypad / ; and "
Keypad * , and . and /
Keypad - ENTER
Keypad + Keypad / * - and +
Microsoft has confirmed this problem with Microsoft QuickBASIC
versions 4.00, 4.00b, and 4.50, and Microsoft BASIC Compiler versions
6.00 and 6.00b for MS-DOS and OS/2 (buglist6.00, buglist6.00b). The
problem does not occur with earlier versions of Microsoft BASICs. This
problem was corrected in Microsoft BASIC Professional Development
System (PDS) version 7.00 (fixlist7.00).
Function keys, editing keys, and most CTRL and ALT key combinations
should be returned from INKEY$ as a two-character code where the first
character is a null character (CHR$(0)) and the second character
identifies the key pressed.
Code Example
------------
The following code example demonstrates how to examine key codes for
any type of key:
WHILE i$ <> CHR$(27) 'Exit with ESC (ESCape) key
i$ = INKEY$
SELECT CASE LEN(i$) 'Type of key depends on length
CASE 1:
PRINT "Single character:", ASC(i$), i$
CASE 2:
PRINT "Double character:", ASC(RIGHT$(i$,1))
CASE ELSE
REM no key pressed
END SELECT
WEND
END
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.