Thread: How would I print out Pressed every time Shift key is pressed?

  1. #1
    Emulator
    Join Date
    Feb 2008
    Posts
    43

    Post How would I print out Pressed every time Shift key is pressed?

    How would I do that? What libraries would I have to use? I want to do this without having a global keyboard hook. Maybe see the state for each key every half a second? Can anyone give me an example? Thanks.
    Hand over your source code, and nobody gets hurt.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    portable libraries like pdcurses or non portable libraries like conio provide keyboard handles. windows.h does too, i think.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Emulator
    Join Date
    Feb 2008
    Posts
    43
    Can you give me an example? :S
    Hand over your source code, and nobody gets hurt.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    With ncurses:

    Code:
    int ch;
    ch = getch();
    if (ch == LEFT_SHIFT) printw("Pressed");
    or something like that. Been a while since I last used the pdcurses library. The define should probably be differently named.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Window message loop (Keys)
    By Blackroot in forum Windows Programming
    Replies: 3
    Last Post: 09-12-2006, 05:15 PM
  2. Simulating Shift Key
    By PrimeTime00 in forum Windows Programming
    Replies: 7
    Last Post: 10-15-2004, 05:53 AM
  3. Shift key extended code
    By Unregistered in forum Game Programming
    Replies: 5
    Last Post: 08-23-2002, 12:35 PM
  4. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM