Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Win 2 API - <b>getkeystate</b> get status of one virtual key http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GetKeyState          Get Status of One Virtual Key

int GetKeyState(nVirtKey)
int nVirtKey; /* A-Z, a-z 0-9 or from table below */

                 msb                                lsb
                +------------------   ------------------+
                |    |          Undefined          |    |
                +------------------   ------------------+
                  |                                  |
                +-------------+     +--------------------------------+
                | 1 = Key Down|     |1 = Pressed odd number of times |
                | 0 = Key Up  |     |0 = Pressed odd number of times |
                +-------------+     +--------------------------------+

                nVirtKey
   |--------------------------------------------------------------------|
   | VK_ADD           VK_F1        VK_HELP          VK_PAUSE            |
   | VK_BACK          VK_F2        VK_HOME          VK_PRINT            |
   | VK_CANCEL        VK_F3        VK_INSERT        VK_PRIOR            |
   | VK_CAPITAL       VK_F4        VK_LBUTTON       VK_RBUTTON          |
   | VK_CLEAR         VK_F5        VK_LEFT          VK_RETURN           |
   | VK_CONTROL       VK_F6        VK_MBUTTON       VK_RIGHT            |
   | VK_COPY          VK_F7        VK_MENU          VK_SELECT           |
   | VK_DECIMAL       VK_F8        VK_MULTIPLY      VK_SEPARATOR        |
   | VK_DELETE        VK_F9        VK_NEXT          VK_SHIFT            |
   | VK_DIVIDE        VK_F10       VK_NUMLOCK       VK_SPACE            |
   | VK_DOWN          VK_F11       VK_NUMPAD0       VK_SUBTRACT         |
   | VK_END           VK_F12       VK_NUMPAD1       VK_TAB              |
   | VK_ESCAPE        VK_F13       VK_NUMPAD2       VK_UP               |
   | VK_EXECUTE       VK_F14       VK_NUMPAD3                           |
   |                  VK_F15       VK_NUMPAD4                           |
   |                  VK_F16       VK_NUMPAD5                           |
   |                               VK_NUMPAD6                           |
   |                               VK_NUMPAD7                           |
   |                               VK_NUMPAD8                           |
   |                               VK_NUMPAD9                           |
   |--------------------------------------------------------------------|
   |VK_A thru VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'|
   |VK_0 thru VK_9 are the same as their ASCII equivalents: '0' thru '0'|
   +--------------------------------------------------------------------+

See Also: GetAsyncKeyState SetKeyboardState

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson