Thread: Detecting keypresses in a console app?

  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    Detecting keypresses in a console app?

    Hey everyone I was just wondering if it was possible to detect a keystroke like an up arrow or down arrow (for menu navigating purposes) in a console program?

    Do I need windows.h to do this?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    If you're on Windows then that is probably your best bet. I don't believe there is a standard way to do it.

  3. #3

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Are the keycodes displayed in the FAQ the ones for windows? They are correct? I didn't know you could do it with getch like that, nifty..
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Console app termination
    By C+/- in forum C++ Programming
    Replies: 2
    Last Post: 05-24-2008, 11:29 AM
  2. Console App w/ Threads and Events?
    By sean in forum C# Programming
    Replies: 1
    Last Post: 07-02-2004, 12:16 AM
  3. Need help migrating console app to windows app
    By DelphiGuy in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2004, 07:05 PM
  4. MSVC Console app - two enters?
    By LuckY in forum Windows Programming
    Replies: 4
    Last Post: 12-30-2003, 02:13 PM
  5. Project Builder console app
    By Luigi in forum C++ Programming
    Replies: 0
    Last Post: 12-28-2002, 07:57 PM