Detecting multiple keypresses - Programmer

This is a discussion on Detecting multiple keypresses - Programmer ; Howdy, I would like to get down to the nitty-gritty of the keyboard's operation. Specifically, I would like to poll only a few keys on the keyboard, and I would like to know when more than one key is pressed. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Detecting multiple keypresses

  1. Detecting multiple keypresses

    Howdy,

    I would like to get down to the nitty-gritty of the keyboard's operation.
    Specifically, I would like to poll only a few keys on the keyboard, and I
    would like to know when more than one key is pressed. In other words, I
    would like to know how to access the keyboard's scan lines, so that if, for
    example, the user is holding two of the arrow keys pressed simultaneously, I
    will get a continuously changing response of Left-Right-Left-Right-and so
    on. So far, all that comes to mind is scanf(), but this is clearly
    inadequate.

    Thanks for your help,
    -Karl



  2. Re: Detecting multiple keypresses

    On Wed, 12 May 2004 12:48:59 -0700, "kstahl" wrote:

    >Howdy,
    >
    >I would like to get down to the nitty-gritty of the keyboard's operation.
    >Specifically, I would like to poll only a few keys on the keyboard, and I
    >would like to know when more than one key is pressed. In other words, I
    >would like to know how to access the keyboard's scan lines, so that if, for
    >example, the user is holding two of the arrow keys pressed simultaneously, I
    >will get a continuously changing response of Left-Right-Left-Right-and so
    >on. So far, all that comes to mind is scanf(), but this is clearly
    >inadequate.
    >
    >Thanks for your help,
    >-Karl
    >


    You need to use WM_KEYUP and WM_KEYDOWN, to get all the up and down keypresses.
    Then, when your program starts, you can set up a map for the keys you are
    interest in, and maintain it then these functions are called.

    Quandon


+ Reply to Thread