Jump to content

KbdSetStatus (FAPI): Difference between revisions

From EDM2
Created page with "==Description== This call sets the characteristics of the keyboard. ==Syntax== <PRE> KbdSetStatus (StatData, KbdHandle) </PRE> ==Parameters== ; StatData (PKBDINFO) - i..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
==Description==
This call sets the characteristics of the keyboard.
This call sets the characteristics of the keyboard.


==Syntax==
==Syntax==
<PRE>
  KbdSetStatus (StatData, KbdHandle)
  KbdSetStatus


    (StatData, KbdHandle)
</PRE>
==Parameters==
==Parameters==
; StatData (PKBDINFO) - input : Address of the keyboard status structure:
;StatData (PKBDINFO) - input : Address of the keyboard status structure:
 
:length (USHORT) : Length, in bytes, of this data structure, including length.
length (USHORT) : Length, in bytes, of this data structure, including length.
::10 - Only valid value.  
 
:sysstate (USHORT) : The system state altered by this call. If bits 0 and 1 are off, the echo state of the system is not altered. If bits 2 and 3 are off, the binary and ASCII state of the system is not altered. If bits 0 and 1 are on, or if bits 2 and 3 are on, the function returns an error. If binary mode is set, echo is ignored.
        10           Only valid value.  
  '''Bit     Description'''
 
  15-9   Reserved, set to zero   
sysstate (USHORT) : The system state altered by this call. If bits 0 and 1 are off, the echo state of the system is not altered. If bits 2 and 3 are off, the binary and ASCII state of the system is not altered. If bits 0 and 1 are on, or if bits 2 and 3 are on, the function returns an error. If binary mode is set, echo is ignored.
  8       Shift return is on   
 
  7       Length of the turn-around character (meaningful only if bit 6 is on).   
  '''Bit               Description'''  
  6       Turn-around character is modified   
  15-9             Reserved, set to zero   
  5       Interim character flags are modified   
  8               Shift return is on   
  4       Shift state is modified   
  7               Length of the turn-around character (meaningful only if bit 6 is on).   
  3       ASCII mode is on   
  6               Turn-around character is modified   
  2       Binary mode is on   
  5               Interim character flags are modified   
  1       Echo off   
  4               Shift state is modified   
  0       Echo on  
  3               ASCII mode is on   
:turnchardef (USHORT) : Definition of the turn-around character. In ASCII and extended-ASCII format, the turn-around character is defined as the carriage return. In ASCII format only, the turn-around character is defined in the low-order byte.
  2               Binary mode is on   
:intcharflag (USHORT) : Interim character flags:
  1               Echo off   
  '''Bit     Description'''  
  0               Echo on  
  15-8   NLS shift state.  
 
  7       Interim character flag is on  
turnchardef (USHORT) : Definition of the turn-around character. In ASCII and extended-ASCII format, the turn-around character is defined as the carriage return. In ASCII format only, the turn-around character is defined in the low-order byte.  
  6       Reserved, set to zero  
 
  5       Application requested immediate conversion  
intcharflag (USHORT) : Interim character flags:
  4-0     Reserved, set to zero
 
:shiftstate (USHORT) : Shift state.
  '''Bit                   Description'''  
  '''Bit     Description'''  
  15-8                   NLS shift state.  
  15       SysReq key down  
  7                   Interim character flag is on  
  14       CapsLock key down  
  6                   Reserved, set to zero  
  13       NumLock key down  
  5                   Application requested immediate conversion  
  12       ScrollLock key down  
  4-0                   Reserved, set to zero  
  11       Right Alt key down  
 
  10       Right Ctrl key down  
shiftstate (USHORT) : Shift state.
  9       Left Alt key down  
 
  8       Left Ctrl key down  
  '''Bit                       Description'''  
  7       Insert on  
  15                       SysReq key down  
  6       CapsLock on  
  14                       CapsLock key down  
  5       NumLock on  
  13                       NumLock key down  
  4       ScrollLock on  
  12                       ScrollLock key down  
  3       Either Alt key down  
  11                       Right Alt key down  
  2       Either Ctrl key down  
  10                       Right Ctrl key down  
  1       Left Shift key down  
  9                       Left Alt key down  
  0       Right Shift key down
  8                       Left Ctrl key down  
;KbdHandle (HKBD) - input : Default keyboard or the logical keyboard.
  7                       Insert on  
  6                       CapsLock on  
  5                       NumLock on  
  4                       ScrollLock on  
  3                       Either Alt key down  
  2                       Either Ctrl key down  
  1                       Left Shift key down  
  0                       Right Shift key down  
 
; KbdHandle (HKBD) - input : Default keyboard or the logical keyboard.


==Return Code==
==Return Code==
  rc (USHORT) - return
  rc (USHORT) - return
Return code descriptions are:
Return code descriptions are:
* 0    NO_ERROR  
* 0    NO_ERROR  
* 376        ERROR_KBD_INVALID_LENGTH  
* 376        ERROR_KBD_INVALID_LENGTH  
Line 81: Line 65:


KbdSetStatus is ignored for a Vio-windowed application.
KbdSetStatus is ignored for a Vio-windowed application.


===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 KbdSetStatus when coding in the DOS mode:
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to KbdSetStatus when coding in the DOS mode:
 
* KbdSetStatus does not accept a bit mask of 10 (ASCII on, Echo Off).
* KbdSetStatus does not accept a bit mask of 10 (ASCII on, Echo Off).  
* Raw (binary) Mode and Echo On are not supported and return an error if requested.
* Raw (binary) Mode and Echo On are not supported and return an error if requested.  
* KbdHandle is ignored.
* KbdHandle is ignored.  
* Interim character is not supported.
* Interim character is not supported.  
* Turnaround character is not supported.
* Turnaround character is not supported.


Line 136: Line 117:
*  
*  


 
[[Category:Dos]]
[[Category:The OS/2 API Project]]

Revision as of 08:18, 20 February 2017

This call sets the characteristics of the keyboard.

Syntax

KbdSetStatus (StatData, KbdHandle)

Parameters

StatData (PKBDINFO) - input
Address of the keyboard status structure:
length (USHORT) : Length, in bytes, of this data structure, including length.
10 - Only valid value.
sysstate (USHORT) : The system state altered by this call. If bits 0 and 1 are off, the echo state of the system is not altered. If bits 2 and 3 are off, the binary and ASCII state of the system is not altered. If bits 0 and 1 are on, or if bits 2 and 3 are on, the function returns an error. If binary mode is set, echo is ignored.
Bit     Description
15-9    Reserved, set to zero  
8       Shift return is on  
7       Length of the turn-around character (meaningful only if bit 6 is on).  
6       Turn-around character is modified  
5       Interim character flags are modified  
4       Shift state is modified  
3       ASCII mode is on  
2       Binary mode is on  
1       Echo off  
0       Echo on 
turnchardef (USHORT) : Definition of the turn-around character. In ASCII and extended-ASCII format, the turn-around character is defined as the carriage return. In ASCII format only, the turn-around character is defined in the low-order byte.
intcharflag (USHORT) : Interim character flags:
Bit     Description 
15-8    NLS shift state. 
7       Interim character flag is on 
6       Reserved, set to zero 
5       Application requested immediate conversion 
4-0     Reserved, set to zero
shiftstate (USHORT) : Shift state.
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 
3        Either Alt key down 
2        Either Ctrl key down 
1        Left Shift key down 
0        Right Shift key down
KbdHandle (HKBD) - input
Default keyboard or the logical keyboard.

Return Code

rc (USHORT) - return

Return code descriptions are:

  • 0 NO_ERROR
  • 376 ERROR_KBD_INVALID_LENGTH
  • 377 ERROR_KBD_INVALID_ECHO_MASK
  • 378 ERROR_KBD_INVALID_INPUT_MASK
  • 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

Shift return (bit 8 in sysstate) must be disabled in ASCII mode.

KbdSetStatus is ignored for a Vio-windowed application.

Family API Considerations

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

  • KbdSetStatus does not accept a bit mask of 10 (ASCII on, Echo Off).
  • Raw (binary) Mode and Echo On are not supported and return an error if requested.
  • KbdHandle is ignored.
  • Interim character is not supported.
  • Turnaround character is not supported.

Example Code

C Binding

typedef struct _KBDINFO {     /* kbst */
  USHORT cb;                  /* length in bytes of this structure */
  USHORT fsMask;              /* bit mask of functions to be altered */
  USHORT chTurnAround;        /* define TurnAround character */
  USHORT fsInterim;           /* interim character flags */
  USHORT fsState;             /* shift states */
}KBDINFO;

#define INCL_KBD

USHORT  rc = KbdSetStatus(Structure, KbdHandle);

PKBDINFO         Structure;     /* Data structure */
HKBD             KbdHandle;     /* Keyboard Handle */

USHORT           rc;            /* return code */

MASM Binding

KBDINFO struc
  kbst_cb           dw  ? ;length in bytes of this structure
  kbst_fsMask       dw  ? ;bit mask of functions to be altered
  kbst_chTurnAround dw  ? ;define TurnAround character
  kbst_fsInterim    dw  ? ;interim character flags
  kbst_fsState      dw  ? ;shift states
KBDINFO ends

EXTRN  KbdSetStatus:FAR
INCL_KBD            EQU 1

PUSH@  OTHER   Structure     ;Data structure
PUSH   WORD    KbdHandle     ;Keyboard Handle
CALL   KbdSetStatus

Returns WORD

Related Functions