 
    
qc_get_key_state
Returns the state of a particular key on the keyboard.
state = qc_get_key_state(key)
    
    Returns the state of a specific key on the keyboard. It reports whether the key is not pressed, is currently being pressed or has just been released.
key
A virtual key code identifying the key. Valid values are:
| Key code | Description | 
|---|---|
| 'A'..'Z' | A letter on the keyboard | 
| '0'..'9' | A number on the keyboard | 
| 1 | Left mouse button | 
| 2 | Right mouse button | 
| 3 | Control-break | 
| 4 | Middle mouse button | 
| 5 | X1 mouse button | 
| 6 | X2 mouse button | 
| 8 | Backspace | 
| 9 | Tab | 
| 12 | Clear | 
| 13 | Enter | 
| 16 | Shift | 
| 17 | Ctrl | 
| 18 | Alt | 
| 19 | Pause | 
| 20 | Caps Lock | 
| 21 | Input Method Editor (IME) Kana/Hangul mode | 
| 23 | IME Junja mode | 
| 24 | IME final mode | 
| 25 | IME Hanja/Kanji mode | 
| 27 | Esc | 
| 28 | IME convert | 
| 29 | IME nonconvert | 
| 30 | IME accept | 
| 31 | IME mode change request | 
| 33 | Page Up | 
| 34 | Page Down | 
| 35 | End | 
| 36 | Home | 
| 37 | Left | 
| 38 | Up | 
| 39 | Right | 
| 40 | Down | 
| 41 | Select | 
| 42 |  | 
| 43 | Execute | 
| 44 | PrtScn (print screen) | 
| 45 | Ins (insert) | 
| 46 | Del (delete) | 
| 47 | Help | 
| 91 | Left Windows | 
| 92 | Right Windows | 
| 93 | Applications | 
| 95 | Sleep | 
| 96 | Numeric keypad 0 | 
| 97 | Numeric keypad 1 | 
| 98 | Numeric keypad 2 | 
| 99 | Numeric keypad 3 | 
| 100 | Numeric keypad 4 | 
| 101 | Numeric keypad 5 | 
| 102 | Numeric keypad 6 | 
| 103 | Numeric keypad 7 | 
| 104 | Numeric keypad 8 | 
| 105 | Numeric keypad 9 | 
| 106 | Multiply (numeric *) | 
| 107 | Add (numeric +) | 
| 108 | Separator | 
| 109 | Subtract (numeric -) | 
| 110 | Decimal (numeric .) | 
| 111 | Divide (numeric /) | 
| 112 | F1 | 
| ... | ... | 
| 135 | F24 | 
| 144 | Num Lock | 
| 145 | Scroll Lock | 
| 160 | Left Shift | 
| 161 | Right Shift | 
| 162 | Left Control | 
| 163 | Right Control | 
| 164 | Left Alt | 
| 165 | Right Alt | 
| 166 | Browser Back | 
| 167 | Browser Forward | 
| 168 | Browser Refresh | 
| 169 | Browser Stop | 
| 170 | Browser Search | 
| 171 | Browser Favourites | 
| 172 | Browser Start/Home | 
| 173 | Volume Mute | 
| 174 | Volume Down | 
| 175 | Volume Up | 
| 176 | Next Track | 
| 177 | Previous Track | 
| 178 | Stop Media | 
| 179 | Play/Pause Media | 
| 180 | Start Mail | 
| 181 | Select Media | 
| 182 | Start Application 1 | 
| 183 | Start Application 2 | 
state
The status of the key. The value is 0 if the key is not pressed. It is less than 0 if the key is currently pressed and it is greater than 0 if the key has just been been released.
        state = qc_get_key_state(27) % Get state of Esc key
        
         
    
Copyright ©2025 Quanser Inc. This page was generated 2025-06-17. "
                Submit feedback to Quanser about this page.
Link to this page.