Thread: getch and alt-extentions

  1. #1
    Temfate
    Guest

    getch and alt-extentions

    Ok; I've been programming for awhile but this has me rather upset and I'm not getting anywhere. Here's the setup:
    /*------------------*/
    #include<stdio.h>
    #include<conio.h>
    int main(void)
    {
    unsigned char command;
    while (1==1)
    {
    command = getch();
    gotoxy(10,10);
    printf("%X",command);
    }
    }
    /*------------------*/
    Now; this returns the hexadecimal code for any character entered. with a REALLY old compiler this gave different values for x and alt-x. With the newer ones (ie. Borland
    5.5) I'm getting no alt-codes added into the return value... Can someone tell me just how to detect alt-x etc in a newer compiler? Thanks!
    (ie Alt-Q) should return (0x10; or 0x00,0x10...)

  2. #2
    Temfate
    Guest
    Ack! Well I've been looking all day now; and can't find out any info on this subject. Does anyone here know? Or am I gonna have to write an entire keyboard handler? For some reason however I do get ctrl codes but ctrl-f and f just return 0x66... Anyone?? Please; I'm going nuts... Maybe I'll just write a handler or look for one...

  3. #3
    Unregistered
    Guest
    In visual c and in several other compilers getch returns characters (including shift-character), function or arrow keys, so no alt keys, certainly not ctrl-c or such ctrl combinations what affect the program and are not supposed to be inputed.

  4. #4
    Unregistered
    Guest
    Hmm; I get ctrl-c as a matter of fact... Just not the alt-combos which it was I want... So... Anyone ever write a keyboard handler? I guess from my understanding I have to just change the interrupt vector 9 to mine?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getch problem
    By rajesh1978 in forum C++ Programming
    Replies: 5
    Last Post: 07-07-2008, 04:19 AM
  2. Trapping Ctrl Alt Delete
    By emus21 in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-17-2003, 12:10 PM
  3. Thanks Stoned_Coder! ALT key works!!
    By johnnyd in forum C Programming
    Replies: 0
    Last Post: 03-11-2002, 10:39 AM
  4. Capturing ALT in C
    By johnnyd in forum C Programming
    Replies: 2
    Last Post: 03-10-2002, 10:03 PM
  5. getch();
    By frenchfry164 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-08-2001, 09:12 PM