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



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98

This article was previously published under Q196900

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.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbKeyIn kbprb KB196900