en:docs:fapi:kbdpeek

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:kbdpeek [2018/08/31 15:16] – created prokusheven:docs:fapi:kbdpeek [2021/09/19 01:38] (current) prokushev
Line 1: Line 1:
 +{{page>en:templates:fapiint}}
 +
 +====== 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 ===== 
- KbdPeek (CharData, KbdHandle)+<code c> 
 +KbdPeek (CharData, KbdHandle) 
 +</code>
  
-==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.  +    asciicharcode ([[UCHAR]]) :  ASCII character code. The scan code received from the keyboard is translated to the ASCII character code. 
-:status (UCHAR) : State of the keystroke event: +    scancode ([[UCHAR]]) :  Code received from the keyboard hardware.  
- '''Bit            Description''' +    status ([[UCHAR]]) : State of the keystroke event: 
- 7-6        00 = Undefined. + 
-            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. | 
-           1 = Immediate conversion requested. +| ::: | 10 = Interim character. | 
- 4-2        Reserved, set to zero. +| ::: | 11 = Final character, interim character flag on. | 
-           0 = Scan code is a character. +|   1 = Immediate conversion requested. | 
-             1 = Scan code is not a character; it is an extended key code from the keyboard. +4-2 Reserved, set to zero.| 
-            1 = Shift status returned without character. +|   0 = Scan code is a character. | 
-: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. +|   1 = Shift status returned without character. | 
- '''Bit    Description''' + 
- 15     SysReq key down +    * reserved ([[UCHAR]]) :  NLS shift status. Reserved, set to zero.  
- 14     CapsLock key down +    shiftkeystat ([[USHORT]]) : Shift key status. 
- 13     NumLock key down + 
- 12     ScrollLock key down +Bit Description ^ 
- 11     Right Alt key down +15 SysReq key down | 
- 10     Right Ctrl key down +14 CapsLock key down | 
-      Left Alt key down +13 NumLock key down | 
-      Left Ctrl key down +12 ScrollLock key down | 
-      Insert on +11 Right Alt key down | 
-      CapsLock on +10 Right Ctrl key down | 
-      NumLock on +Left Alt key down | 
-      ScrollLock on +Left Ctrl key down | 
-      Either Alt key down +Insert on | 
-      Either Ctrl key down +CapsLock on | 
-      Left Shift key down +NumLock on | 
-      Right Shift key down +ScrollLock on | 
-:time (ULONG) : Time stamp indicating when a key was pressed. It is specified in milliseconds from the time the system was started. +Either Alt key down | 
-KbdHandle (HKBD) - input : Default keyboard or the logical keyboard.+Either Ctrl key down | 
 +Left Shift key down | 
 +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. 
 +  KbdHandle ([[HKBD]]) - input : Default keyboard or the logical keyboard. 
 + 
 +===== Return Code ===== 
 + 
 +rc ([[USHOR]]T) - return
  
-==Return Code== 
- rc (USHORT) - return 
 Return code descriptions are: Return code descriptions are:
-* 0    NO_ERROR  
-* 439   ERROR_KBD_INVALID_HANDLE  
-* 445   ERROR_KBD_FOCUS_REQUIRED  
-* 447   ERROR_KBD_KEYBOARD_BUSY  
-* 464   ERROR_KBD_DETACHED  
-* 504   ERROR_KBD_EXTENDED_SG 
  
-==Remarks==+  * 0    NO_ERROR  
 +  * 439   ERROR_KBD_INVALID_HANDLE  
 +  * 445   ERROR_KBD_FOCUS_REQUIRED  
 +  * 447   ERROR_KBD_KEYBOARD_BUSY  
 +  * 464   ERROR_KBD_DETACHED  
 +  * 504   ERROR_KBD_EXTENDED_SG 
 + 
 +===== 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.  +  * 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;             /* ASCII character code */   UCHAR    chChar;             /* ASCII character code */
Line 89: Line 106:
  
 USHORT           rc;            /* return code */ USHORT           rc;            /* return code */
-</PRE>+</code>
  
-===MASM Binding=== +====MASM Binding==== 
-<PRE>+<code asm>
 KBDKEYINFO struc KBDKEYINFO struc
   kbci_chChar    db  ? ;ASCII character code   kbci_chChar    db  ? ;ASCII character code
Line 110: Line 127:
  
 Returns WORD Returns WORD
-</PRE>+</code>
  
  
  
-====== Note ======+===== Note =====
  
 Text based on [[http://www.edm2.com/index.php/KbdPeek_(FAPI)]] Text based on [[http://www.edm2.com/index.php/KbdPeek_(FAPI)]]