Thread: arrow keys, ctrl and alt keys

  1. #1
    Unregistered
    Guest

    arrow keys, ctrl and alt keys

    I need help with using arrows and the ctrl and alt keys.
    how do I use them (Specific Code, ASCI)

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    132

    how to use the keys

    Ok, this is pretty easy. First, you need to define the keys that you want to use:

    #define UP 72
    #define DOWN 80
    #define LEFT 75
    #define RIGHT 77
    #define ENTER 28
    #define ESCAPE 1
    #define CONTROL 29
    #define L_SHIFT 42
    #define R_SHIFT 54
    #define WIN 91
    #define ALT 56
    #define TAB 15

    Now all you need to do is use them as variables for example:

    int Direction=getch();

    if (Direction==UP)
    y++;

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Or you could do a board search and look this up....its not as if its never been asked!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Grabbing Ctrl and Alt key combinations
    By scorpio_IITR in forum Linux Programming
    Replies: 0
    Last Post: 04-12-2004, 03:01 AM
  2. how to capture CTRL, SHIFT and ALT ?
    By goldenrock in forum C Programming
    Replies: 3
    Last Post: 11-06-2003, 01:20 AM
  3. Trapping Ctrl Alt Delete
    By emus21 in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-17-2003, 12:10 PM
  4. Recognizing ALT or Ctrl + letter
    By MethodMan in forum C Programming
    Replies: 2
    Last Post: 02-22-2003, 07:16 PM
  5. Ctrl + Alt +Delete
    By golfinguy4 in forum Windows Programming
    Replies: 4
    Last Post: 10-27-2002, 07:46 PM