scanning the keyboard

This is a discussion on scanning the keyboard within the C Programming forums, part of the General Programming Boards category; how can i be able to poll interrupts from some keys on the keyboard using a C code. i dont ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Location
    Nairobi, Kenya
    Posts
    4

    scanning the keyboard

    how can i be able to poll interrupts from some keys on the keyboard using a C code. i dont know the methods and the header files to include

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    What OS?

  3. #3
    Registered User
    Join Date
    Jan 2009
    Location
    Nairobi, Kenya
    Posts
    4
    Windows Xp

  4. #4
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    If you're wanting to detect keypresses, the easiest way to do it is probably by including windows.h (Windows API Header File) and using either GetAsyncKeyState or by processing messages sent to the message queue of your program. Another way is to install a hook to monitor system or thread keyboard messages.

    The one that you want to use will probably depend on what you are writing.

    P.S I'm assuming that's what you mean by poll interrupts (Which is used in DOS??).

  5. #5
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by karfes View Post
    how can i be able to poll interrupts from some keys on the keyboard using a C code. i dont know the methods and the header files to include
    Do you mean how do I know is a key is pressed?

  6. #6
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    You should get an idea on how to do it from the following FAQ.

    http://faq.cprogramming.com/cgi-bin/...&id=1043284392

    -ssharish
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting keyboard and mouse in linux
    By sameer.nalwade in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 04:24 AM
  2. Keyboard port using other that a keyboard
    By antoinelac in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2008, 03:46 PM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Keyboard hook
    By joecaveman in forum Windows Programming
    Replies: 2
    Last Post: 09-03-2005, 09:07 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 04:34 PM

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