Detecting keypresses in a console app?

This is a discussion on Detecting keypresses in a console app? within the C++ Programming forums, part of the General Programming Boards category; Hey everyone I was just wondering if it was possible to detect a keystroke like an up arrow or down ...

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

    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,317
    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
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,642

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    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, 06:05 PM
  4. MSVC Console app - two enters?
    By LuckY in forum Windows Programming
    Replies: 4
    Last Post: 12-30-2003, 01:13 PM
  5. Project Builder console app
    By Luigi in forum C++ Programming
    Replies: 0
    Last Post: 12-28-2002, 06:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21