Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!fuug!funic!santra!taltta.hut.fi!d37703j From: d37703j@taltta.hut.fi (Petteri Stenius) Newsgroups: comp.lang.pascal Subject: Re: How to read the 'dead' key in TP ? Keywords: turbo pascal Message-ID: <1991Jan4.135331.7656@santra.uucp> Date: 4 Jan 91 13:53:31 GMT References: <4595@ruuinf.cs.ruu.nl> Sender: news@santra.uucp (Cnews - USENET news system) Reply-To: d37703j@taltta.hut.fi (Petteri Stenius) Organization: Helsinki University of Technology, FINLAND Lines: 56 In article <4595@ruuinf.cs.ruu.nl> jschippe@cs.ruu.nl (Jeroen Schipper) writes: >Can anyone tell me how I can check if the '5' on the >numeric keypad has been pressed when numlock is off? > >I would also like to know how to read F11 and F12 in >TP. > You could use interrupt 16H function 10H to read the scan code from the keyboard. The following program shows the character and scan code read from the keyboard. uses dos; type KeyType = record ch : byte; scan : byte; end; procedure GetScan(var result : KeyType); var regs : registers; begin regs.ah := $10; intr($16,regs); result.scan := regs.ah; result.ch := regs.al; end; var ch : KeyType; begin repeat GetScan(ch); writeln(ch.ch:4, ch.scan:4); until ch.ch = 27; { repeats until ESC is pressed } end. Pressing '5' on the numpad with numlock on generates ch = 53 and scan = 76 with numlock off you get ch = 0 and scan = 76 F11 gives ch = 0 and scan = 133 F12 gives ch = 0 and scan = 134 >Jeroen. Petteri