Knowledge Base

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

Article ID: 196900

Article Last Modified on 7/11/2005


APPLIES TO


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.

Keywords: kbkeyin kbprb KB196900