PRB: Getch() returns wrong keyboard values when CAPSLOCK is on.

ID: Q196900


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
    on the following platforms: Win95, Win98


SYMPTOMS

If the CAPSLOCK key is turned on and if non-alphabetic keys (such as 1,2,3,;,[, and so on) are pressed, getch() returns !,@,#,:,{,... In other words, it acts as if the SHIFT key is being pressed. This applies to all the numeric and punctuation keys. This problem occurs in Windows 95 and Windows 98.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

Create a simple console application, with the following code snippet:

   char c;
     ...

     c = getch();
     printf( "%c \n",c );

     ... 
RESULTS: If the CAPS LOCK is turned on and if you press the non-alphabetic keys (1,2,3,;,[, and so on), getch() returns !,@,#,:,{... in Windows 95 and Windows 98.

This problem does not occur in Windows NT.

Additional query words:

Keywords : kbKeyIn kbSDKPlatform kbWinOS95 kbWinOS98
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: January 12, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.