Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!msi.umn.edu!umeecs!heavy From: heavy@zip.eecs.umich.edu (Richard Scott Hall) Newsgroups: comp.sys.atari.st.tech Subject: Re: Getting ASCII value from scancode Message-ID: <1991Apr27.172516.29313@zip.eecs.umich.edu> Date: 27 Apr 91 17:25:16 GMT References: <1991Apr26.232519.12216@zip.eecs.umich.edu> <80354@bu.edu.bu.edu> Distribution: all Organization: University of Michigan EECS Dept. Lines: 49 In article <80354@bu.edu.bu.edu> harryk@bucsf.bu.edu (Harry Karayiannis) writes: >In article <1991Apr26.232519.12216@zip.eecs.umich.edu> heavy@zip.eecs.umich.edu (Richard Scott Hall) writes: >> >> it is possible to press any ALT+ sequence in my program. >> When I get a keyboard event, I get the keyboard state from >> vq_key_s() (i.e. shift/control/alt), but I get the scancode >> from evnt_keybd/multi. So i guess what I am asking, is there >> anyway to go from scancode to ASCII without having to define >> all the values in my program? >> >>Richard Hall >>University of Michigan > > You should use evnt_keybd() which returns an integer. > > Now, the high-order byte contains the scan code of the key pressed, > and the low-order byte contains the ASCII code. > Yes, it does, but not if someone presses 'ATL+A'. The low order bits in this case are zero. I want to be able to see that they pressed 'A' while holding down 'ATL'. I can get the keyboard state with vq_key_s() (this tells me if they are holding down shift/control/alt), but what I need to know now is what ASCII key they pressed with it. So if I can get some method to find this out, I won'd need some big if-then-else-if structure to key for a specific value...for instance, 'ATL+A' = 0x1e00, 'ATL+B' = 0x3000. Now the only what I know which ASCII key they pressed is by having some code like: if (key == 0x1e00) c = 'A'; else if (key == 0x3000) c = 'B'; . . . ad infinitum I don't really want to do this, but it might be necessary. Richard Hall University of Michigan -- Standard disclaimer: I am not me, I am who you think you are... so don't blame me.