Microsoft KB Archive/59006

= How to Distinguish Between a Standard and Enhanced Keyboard =

Article ID: 59006

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q59006



SUMMARY
The following code example demonstrates how to determine whether an enhanced or standard keyboard is connected to a machine by calling certain ROM interrupts. The information about Interrupt 16h, with Functions 2h and 12h, also applies to any language that can call ROM BIOS interrupts.



MORE INFORMATION
The information for the interrupts was taken from Pages 581-586 of the book &quot;Advanced MS-DOS Programming, Second Edition,&quot; by Ray Duncan, (Microsoft Press, 1988). This information can also be found on Pages 105-112 of the &quot;Programmer's Quick Reference Series: IBM ROM BIOS,&quot; by Ray Duncan (Microsoft Press, 1988).

The information about the address for the PEEK statement was taken from Pages 137 and 138 of the book &quot;The New Peter Norton Programmer's Guide to the IBM PC and PS/2,&quot; by Peter Norton and Richard Wilton, (Microsoft Press, 1988).

To compile and link the program in Microsoft Visual Basic for MS-DOS, version 1.0, do the following: BC Keytest.BAS; LINK Keytest,,,VBDOS.LIB; To compile and link the program in Microsoft QuickBasic for MS-DOS, verison 4.5, do the following: BC Keytest.bas ; LINK Keytest,,,BRUN45.LIB+QB.LIB ;

Code Example
' Use the following include file for Visual Basic for MS-DOS 1.0: REM $INCLUDE: 'VBDOS.BI' ' Use the following include file for QuickBasic for MS-DOS 4.5: ' REM $INCLUDE: 'qb.bi' ' Use the following include file for Basic PDS for MS-DOS 7.0: ' REM $INCLUDE: 'qbx.bi' DIM inregs AS regtype, outregs AS regtype CLS inregs.ax = &H1200 CALL interrupt(&H16, inregs, outregs) key2% = outregs.ax DEF SEG = &H40 test% = PEEK(&H17) DEF SEG LOCATE 13, 23 IF key2% <> test% THEN PRINT &quot;You have a Standard Keyboard&quot; IF key2% = test% THEN PRINT &quot;You have an Enhanced Keyboard&quot; LOCATE 25, 20 PRINT &quot;Hit a key to end test&quot; SLEEP CLS END

Additional query words: VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.50 6.00 6.00b 7.00

Keywords: KB59006

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.