_InKey( ) API Library Routine

Example

Returns the first key typed during the timeout period.

Syntax

int _InKey(int timeout, int flag)
int timeout;                  /* Timeout period. */
int flag;                     /* Option(s). */

Remarks

The timeout period is specified as a number of Operating system timer ticks (1000/second). A timeout period of 0 causes Visual FoxPro to wait until the user presses a key. A negative timeout value causes _InKey( ) to return to the calling program immediately if the user doesn't press a key.

You can specify flag as one or both of the following options:

Use SHOWCURSOR to force the cursor to appear, or HIDECURSOR to force the cursor to disappear. If neither is specified, the cursor respects the SYS(2002) setting. The additional flag value MOUSEACTIVE causes _InKey( ) to treat mouse clicks as keystrokes. _InKey returns 151 for a mouse click. To specify two flag values, use the C | or + operator.

Note   Idle routines must not call _InKey( ).

You can write event handlers that call _InKey( ), but you must be careful because _InKey( ) calls the event handler recursively.

For more information on how to create an API library and integrate it with Visual FoxPro, see Chapter 28, Accessing the Visual FoxPro API, in the Programmer's Guide.