key detection

This is a discussion on key detection within the C++ Programming forums, part of the General Programming Boards category; is there a way to detect if 2 keys are being pressed at once or if a key is being ...

  1. #1
    Unregistered
    Guest

    key detection

    is there a way to detect if 2 keys are being pressed at once or if a key is being held down? i need this for a pong program i have made, as of right now only one paddle can move at an instant and you have to tap the key to make it move

  2. #2
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    857

    Cannot detect two keys

    kbhit and getch can only detect one key so, no luck.
    Yoshi

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    if this is a windows program or windows console program then you have access to the win32 api. One function that you will find useful is GetAsyncKeyState(). Search for information on its use in either your help files or at msdn.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM

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