Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: ASCII for Alt key  (Read 8597 times)

0 Members and 1 Guest are viewing this topic.

glindhot

  • Guest
ASCII for Alt key
« on: October 30, 2006, 05:04:43 PM »
Keys have ASCII values, eg, Esc is ASCII 27, Enter is ASCII 13

As far as I can tell, the Alt key does not have an ASCII value,
but is there any ASCII combination, or whatever, that will produce it?  

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: ASCII for Alt key
« Reply #1 on: October 30, 2006, 11:44:56 PM »
Will the keyboard scancode be of any use :-?

The scancode for Alt is hex 38
One good deed is worth more than a year of good intentions.

2k_dummy



    Specialist
  • A word, once spoken, can never be recalled.
  • Thanked: 14
    Re: ASCII for Alt key
    « Reply #2 on: October 31, 2006, 01:27:24 PM »
    There are different sets of scancodes for different types of keyboards. I think set 3 is most common and is for the 101 key enhanced keyboard. Scancode 38 would be the ascii scancode for ALT. The hex code for ALT is 11 and EO 11 (left alt and right alt). You could probably stuff these values to the keyboard buffer to simulate the ALT key press. There is no true ascii value for the ALT key since it is a modifier for other key presses.
    If you don't stand for something, you'll fall for anything.
    _______________________________________ ________
    BlackViper

    Software and utilities

    Rob Pomeroy



      Prodigy

    • Systems Architect
    • Thanked: 124
      • Me
    • Experience: Expert
    • OS: Other
    Re: ASCII for Alt key
    « Reply #3 on: October 31, 2006, 01:28:14 PM »
    Quote
    Keys have ASCII values
    And I'm afraid that's where you'd be wrong.  Dusty's right; scan codes are not the same as ASCII codes.  Shift, ctrl, alt etc do not have corresponding ASCII codes; to test for them you'd need to use a keyboard interface library.
    Only able to visit the forums sporadically, sorry.

    Geek & Dummy - honest news, reviews and howtos

    Rob Pomeroy



      Prodigy

    • Systems Architect
    • Thanked: 124
      • Me
    • Experience: Expert
    • OS: Other
    Re: ASCII for Alt key
    « Reply #4 on: October 31, 2006, 01:28:55 PM »
    Oops.  Everybody jumps on the newbie...   ;D
    Only able to visit the forums sporadically, sorry.

    Geek & Dummy - honest news, reviews and howtos

    2k_dummy



      Specialist
    • A word, once spoken, can never be recalled.
    • Thanked: 14
      Re: ASCII for Alt key
      « Reply #5 on: October 31, 2006, 01:42:10 PM »
      If he can interface the keyboard, if the 3rd bit is set to 00, the keyboard will return the scancode set that it is using. If it is not as expected, he would have to create a lookup table to retrieve the proper scancode. Not exactly the simplest of tasks. The newer 120+ key keyboards have additional scancodes for the extra keys; however, the main keys must be backward compatable with the 101 enhanced keyboard.

      This is not my forte! I'm gonna quit while I still can. ;D
      If you don't stand for something, you'll fall for anything.
      _______________________________________ ________
      BlackViper

      Software and utilities

      Dusty



        Egghead

      • I could if she would, but she won't so I don't.
      • Thanked: 75
      • Experience: Beginner
      • OS: Windows XP
      Re: ASCII for Alt key
      « Reply #6 on: October 31, 2006, 03:39:28 PM »
      Maybe I over-simplified the use of scancodes, it's quite a complex subject for a new-comer and some of us older-comers.  I found this to be a good reference.  The entire site starting here is good reading for a wet Sunday afternoon ;D

      Good luck
      « Last Edit: October 31, 2006, 03:45:33 PM by Dusty »
      One good deed is worth more than a year of good intentions.