| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Puts an inkey code into the keyboard buffer.
HB_KeyPut( <nInkeyCode> ) --> NIL
The return value is always NIL.
Function HB_KeyPut() extends the KEYBOARD command and allows for adding numeric Inkey() codes to the keyboard buffer whose values are outside the range of 1 to 255.
HB_KeyPut() adds <nInkeyCode> to the keyboard buffer without removing pending keys from the buffer. The function can add only one Inkey() code at a time. To add multiple key codes, the function must be called repeatedly.
| See also: | KEYBOARD, CLEAR TYPEAHEAD, Inkey() |
| Category: | Keyboard functions |
| Header: | inkey.ch |
| Source: | rtl\inkey.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example outlines the difference between the KEYBOARD command
// and HB_KeyPut() with an Inkey() code greater than 255
#include "Inkey.ch"
PROCEDURE Main
? K_ALT_PGDN // result: 417
KEYBOARD Chr( K_ALT_PGDN )
? Inkey() // result: 161
? Asc( Chr( K_ALT_PGDN ) ) // result: 161
HB_KeyPut( K_ALT_PGDN )
? Inkey() // result: 417
RETURN
http://www.xHarbour.com