INKEY( ) Function

Returns a number corresponding to the first mouse click or key press in the type-ahead buffer.

INKEY([nSeconds] [, cHideCursor])



Specifies the number of seconds to wait for a keystroke. If you do not specify a value for nSeconds, INKEY( ) returns a value for a keystroke immediately. If nSeconds is 0, INKEY( ) waits indefinitely for a keystroke.


Shows or hides the cursor, or checks for a mouse click.

The following table lists values for cHideCursor.

cHideCursor Description


Show cursor.


Hide cursor.


Check for a mouse click.


Expand the keyboard macro if a keyboard macro is assigned to a key or key combination. To return successive values for each keystroke in a macro, execute INKEY( ) repeatedly with E included.


If both S and H are included in cHideCursor, the latter character specified takes precedence. You can combine values for cHideCursor, for example, to check for a mouse click and show the cursor, include M and S. To check for a mouse click and hide the cursor, include H and M. INKEY( ) disregards characters other than S, H, M, and E in cHideCursor.

Expand imageReturn Value

Expand imageSee Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic