Table of Contents

This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

2021/09/17 04:47 · prokushev · 0 Comments
2021/08/20 03:18 · prokushev · 0 Comments

KbdStringIn

This call reads a character string (character codes only) from the keyboard.

Syntax

KbdStringIn (CharBuffer, StringLength, IOWait, KbdHandle)

Parameters

Return Code

rc (USHORT) - return

Return code descriptions are:

Remarks

The character strings may be optionally echoed on the display if echo mode is set. When echo is on each character is echoed as it is read from the keyboard. Echo mode and BINARY mode are mutually exclusive. Reference KbdSetStatus and KbdGetStatus for more information.

The default input mode is ASCII. In ASCII mode, 2-byte character codes only return in complete form. An extended ASCII code is returned in a 2-byte string. The first byte is 0DH or E0H and the next byte is an extended code.

In input mode (BINARY, ASCII), The following returns can be set and retrieved with KbdSetStatus and KbdGetStatus:

The received input length is also used by the KbdStringIn line edit functions for re-displaying and entering a caller specified string. On the next KbdStringIn call the received input length indicates the length of the input buffer that may be recalled by the user using the line editing keys. A value of 0 inhibits the line editing function for the current KbdStringIn request.

KbdStringIn completes when the handle has access to the physical keyboard (focus), or is equal to zero and no other handle has the focus.

Family API Considerations

Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to KbdStringIn when coding in the DOS mode:

Refer to the DosRead Family API Considerations for differences between DOS and OS/2 node when reading from a handle opened to the CON device.

Bindings

C Binding

typedef struct _STRINGINBUF {   /* kbsi */
  USHORT cb;                    /* input buffer length */
  USHORT cchIn;                 /* received input length */
} STRINGINBUF;
 
#define INCL_KBD
 
USHORT  rc = KbdStringIn(CharBuffer, Length, IOWait, KbdHandle);
 
PCH              CharBuffer;    /* Char string buffer */
PSTRINGINBUF     Length;        /* Length table */
USHORT           IOWait;        /* Indicate if wait for char */
HKBD             KbdHandle;     /* Keyboard handle */
 
USHORT           rc;            /* return code */

MASM Binding

STRINGINBUF struc
  kbsi_cb    dw  ? ;input buffer length
  kbsi_cchIn dw  ? ;received input length
STRINGINBUF ends
 
EXTRN  KbdStringIn:FAR
INCL_KBD            EQU 1
 
PUSH@  OTHER   CharBuffer    ;Char string buffer
PUSH@  OTHER   Length        ;Length table
PUSH   WORD    IOWait        ;Indicate if wait for char
PUSH   WORD    KbdHandle     ;Keyboard handle
CALL   KbdStringIn
 
Returns WORD

Note

Text based on http://www.edm2.com/index.php/KbdStringIn_(FAPI)