Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:docs:fapi:kbdpeek [2018/08/31 15:16] – created prokushev | en:docs:fapi:kbdpeek [2021/09/19 01:38] (current) – prokushev | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{page> | ||
| + | |||
| + | ====== KbdPeek ====== | ||
| + | |||
| This call returns any available character data record from the keyboard without removing it from the buffer. | This call returns any available character data record from the keyboard without removing it from the buffer. | ||
| - | ==Syntax== | + | ===== Syntax |
| - | | + | <code c> |
| + | KbdPeek (CharData, KbdHandle) | ||
| + | </ | ||
| - | ==Parameters== | + | ===== Parameters |
| - | ;CharData (PKBDKEYINFO) - output : Address of the character data information: | + | |
| - | :asciicharcode (UCHAR) : ASCII character code. The scan code received from the keyboard is translated to the ASCII character code. | + | * CharData ([[PKBDKEYINFO]]) - output : Address of the character data information: |
| - | :scancode (UCHAR) : Code received from the keyboard hardware. | + | |
| - | :status (UCHAR) : State of the keystroke event: | + | |
| - | ''' | + | |
| - | | + | |
| - | 01 = Final character, interim character flag off. | + | ^ Bit ^ Description |
| - | 10 = Interim character. | + | | 7-6 | 00 = Undefined. |
| - | 11 = Final character, interim character flag on. | + | | ::: | 01 = Final character, interim character flag off. | |
| - | | + | | ::: | 10 = Interim character. |
| - | | + | | ::: | 11 = Final character, interim character flag on. | |
| - | | + | | |
| - | | + | | 4-2 | Reserved, set to zero.| |
| - | | + | | |
| - | :reserved (UCHAR) : NLS shift status. Reserved, set to zero. | + | | ::: | 1 = Scan code is not a character; it is an extended key code from the keyboard. |
| - | :shiftkeystat (USHORT) : Shift key status. | + | | |
| - | ''' | + | |
| - | | + | * reserved ([[UCHAR]]) : NLS shift status. Reserved, set to zero. |
| - | | + | |
| - | | + | |
| - | | + | ^ Bit ^ Description |
| - | | + | | 15 | SysReq key down | |
| - | | + | | 14 | CapsLock key down | |
| - | | + | | 13 | NumLock key down | |
| - | | + | | 12 | ScrollLock key down | |
| - | | + | | 11 | Right Alt key down | |
| - | | + | | 10 | Right Ctrl key down | |
| - | | + | | 9 | Left Alt key down | |
| - | | + | | 8 | Left Ctrl key down | |
| - | | + | | 7 | Insert on | |
| - | | + | | 6 | CapsLock on | |
| - | | + | | 5 | NumLock on | |
| - | | + | | 4 | ScrollLock on | |
| - | :time (ULONG) : Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. | + | | 3 | Either Alt key down | |
| - | ; KbdHandle (HKBD) - input : Default keyboard or the logical keyboard. | + | | 2 | Either Ctrl key down | |
| + | | 1 | Left Shift key down | | ||
| + | | 0 | Right Shift key down | | ||
| + | |||
| + | * time ([[ULONG]]) : Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. | ||
| + | | ||
| + | |||
| + | ===== Return Code ===== | ||
| + | |||
| + | rc ([[USHOR]]T) - return | ||
| - | ==Return Code== | ||
| - | rc (USHORT) - return | ||
| Return code descriptions are: | Return code descriptions are: | ||
| - | * 0 NO_ERROR | ||
| - | * 439 | ||
| - | * 445 | ||
| - | * 447 | ||
| - | * 464 | ||
| - | * 504 | ||
| - | ==Remarks== | + | * 0 NO_ERROR |
| + | * 439 | ||
| + | * 445 | ||
| + | * 447 | ||
| + | * 464 | ||
| + | * 504 | ||
| + | |||
| + | ===== Remarks ===== | ||
| On an enhanced keyboard, the secondary enter key returns the normal character 0DH and a scan code of E0H. | On an enhanced keyboard, the secondary enter key returns the normal character 0DH and a scan code of E0H. | ||
| Line 62: | Line 77: | ||
| A thread in the foreground session that repeatedly polls the keyboard with KbdCharIn (with no wait), can prevent all regular priority class threads from executing. If polling must be used and a minimal amount of other processing is being performed, the thread should periodically yield the CPU by issuing a DosSleep call for an interval of at least 5 milliseconds. | A thread in the foreground session that repeatedly polls the keyboard with KbdCharIn (with no wait), can prevent all regular priority class threads from executing. If polling must be used and a minimal amount of other processing is being performed, the thread should periodically yield the CPU by issuing a DosSleep call for an interval of at least 5 milliseconds. | ||
| - | ===Family API Considerations=== | + | ==== Family API Considerations ==== |
| Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to KbdPeek when coding for the DOS mode: | Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to KbdPeek when coding for the DOS mode: | ||
| - | * The CharData structure includes everything except the time stamp. | + | |
| - | * Interim character is not supported. | + | * Interim character is not supported. |
| - | * Status can be 0 or 1. | + | * Status can be 0 or 1. |
| - | * KbdHandle is ignored. | + | * KbdHandle is ignored. |
| + | |||
| + | ===== Bindings ===== | ||
| - | ==Example Code== | + | ====C Binding==== |
| - | ===C Binding=== | + | <code c> |
| - | <PRE> | + | |
| typedef struct _KBDKEYINFO { /* kbci */ | typedef struct _KBDKEYINFO { /* kbci */ | ||
| UCHAR chChar; | UCHAR chChar; | ||
| Line 89: | Line 106: | ||
| USHORT | USHORT | ||
| - | </PRE> | + | </code> |
| - | ===MASM Binding=== | + | ====MASM Binding==== |
| - | <PRE> | + | <code asm> |
| KBDKEYINFO struc | KBDKEYINFO struc | ||
| kbci_chChar | kbci_chChar | ||
| Line 110: | Line 127: | ||
| Returns WORD | Returns WORD | ||
| - | </PRE> | + | </code> |
| - | ====== Note ====== | + | ===== Note ===== |
| Text based on [[http:// | Text based on [[http:// | ||




