Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!purdue!haven!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: (R)Scan codes in TurboPascal Message-ID: <24528@adm.BRL.MIL> Date: 17 Sep 90 15:35:38 GMT Sender: news@adm.BRL.MIL Lines: 35 In article <1561.26f20a24@waikato.ac.nz>, Ian McDonald asks >How do you pick up Scan codes in TP 5.5? From my reading of the manuals >you have to resort to machine code. I am after picking up Ctrl-ESC as >well as just Esc as ReadKey doesn't differentiate. I've been using TurboPower's libraries for so long now that my immediate reflex was to tell you to call ReadKeyWord. However, if you don't use TurboProfessional or ObjectProfessional, and you are interested in picking up scan codes for keys that return characters <> #0 (CRT.ReadKey can return scan codes for those keys which return #0), then the general solution is to call INT $16 directly, with AH=0. Now for the bad news: Ctrl-Esc is _never_ going to return anything different than plain Esc. Esc is ^[, and you are asking the system to distinguish between that and ^^[. It won't. The best you can hope for is to read the state of the shift keys when you call ReadKey or your INT $16 routine. Other replies have shown how to do that, and have pointed out that the shift state you determine will be that at the time of the call and not necessarily the one corresponding to the keypress that fed ReadKey or your INT $16 routine. The only way I see for you to accomplish your goal is to write your own keyboard handler so you can determine the shift state _at the time of the keypress_ and flag the keypresses of interest somehow. +-------------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | phone 404/639-2709 Epidemiology Program Office | | fts 236-2709 Atlanta, GA | | | | Home of Epi Info 5.0 | +-------------------------------------------------------------------------+