From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: Keyboard Date: Wed, 19 Aug 1998 14:19:35 -0300 Organization: NBTel Internet Lines: 34 Message-ID: <35DB0926.7F3AA022@unb.ca> References: <903476490 DOT 984559 AT polka> NNTP-Posting-Host: fctnts13c40.nbnet.nb.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Sylvester Hesp wrote: > char key[128]; > void timer_handler () > { > int k; > k = inportb (0x60) > if (k > 128) > key[k - 128] = 0; > else > key[k] = 1; > } > > If I want to know if a user is pressing [esc] I just check if the value > in key[SCAN_CODE_ESC] == 1. But now, I can't read the lock-keys and I can't > distinguish the left CTRL/ALT with the right CTRL/ALT and the 2 cursor keys > (grey (those 4 in the middle) and white) Why is that function called 'timer_handler'? Are you running it off of the timer? Well, assuming you AREN'T, to detect those other keys, 'Extended' keys return 224 before the key-code. So for RightAlt, the codes 224, 56 would occur in that order. The same is true for all extended keys (like the arrow keys, number-pad-enter and stuff). This will also let you detect the 'Win95' special keys (only in DOS). I think the 'Start' button is 224, 91. -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlis AT nbnet DOT nb DOT ca