no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | en:docs:fapi:kbdpeek [2018/08/31 15:16] – created prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This call returns any available character data record from the keyboard without removing it from the buffer. | ||
+ | |||
+ | ==Syntax== | ||
+ | | ||
+ | |||
+ | ==Parameters== | ||
+ | ;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. | ||
+ | 10 = Interim character. | ||
+ | 11 = Final character, interim character flag on. | ||
+ | | ||
+ | | ||
+ | | ||
+ | 1 = Scan code is not a character; it is an extended key code from the keyboard. | ||
+ | | ||
+ | :reserved (UCHAR) : NLS shift status. Reserved, set to zero. | ||
+ | : | ||
+ | ''' | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | :time (ULONG) : Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. | ||
+ | ; KbdHandle (HKBD) - input : Default keyboard or the logical keyboard. | ||
+ | |||
+ | ==Return Code== | ||
+ | rc (USHORT) - return | ||
+ | Return code descriptions are: | ||
+ | * 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. | ||
+ | |||
+ | Double-byte character codes (DBCS) require two function calls to obtain the entire code. | ||
+ | |||
+ | If shift report is set with KbdSetStatus the CharData record returned, reflects changed shift information only. | ||
+ | |||
+ | Extended ASCII codes are identified with the status byte, bit 1 on and the ASCII character code being either 00H or E0H. Both conditions must be satisfied for the character to be an extended keystroke. For extended ASCII codes, the scan code byte returned is the second code (extended code). Usually the extended ASCII code is the scan code of the primary key that was pressed. | ||
+ | |||
+ | 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=== | ||
+ | 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. | ||
+ | * Status can be 0 or 1. | ||
+ | * KbdHandle is ignored. | ||
+ | |||
+ | ==Example Code== | ||
+ | ===C Binding=== | ||
+ | <PRE> | ||
+ | typedef struct _KBDKEYINFO { /* kbci */ | ||
+ | UCHAR chChar; | ||
+ | UCHAR chScan; | ||
+ | UCHAR fbStatus; | ||
+ | UCHAR bNlsShift; | ||
+ | USHORT | ||
+ | ULONG time; /* Time stamp of keystroke (ms since ipl) */ | ||
+ | }KBDKEYINFO; | ||
+ | |||
+ | #define INCL_KBD | ||
+ | |||
+ | USHORT | ||
+ | |||
+ | PKBDKEYINFO | ||
+ | HKBD | ||
+ | |||
+ | USHORT | ||
+ | </ | ||
+ | |||
+ | ===MASM Binding=== | ||
+ | <PRE> | ||
+ | KBDKEYINFO struc | ||
+ | kbci_chChar | ||
+ | kbci_chScan | ||
+ | kbci_fbStatus | ||
+ | kbci_bNlsShift db ? ;Reserved (set to zero) | ||
+ | kbci_fsState | ||
+ | kbci_time | ||
+ | KBDKEYINFO ends | ||
+ | |||
+ | EXTRN KbdPeek:FAR | ||
+ | INCL_KBD | ||
+ | |||
+ | PUSH@ OTHER | ||
+ | PUSH | ||
+ | CALL | ||
+ | |||
+ | Returns WORD | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Note ====== | ||
+ | |||
+ | Text based on [[http:// | ||
+ | |||
+ | {{page> | ||
+ | |||