Back to main

 

Function 2 - get the code of the pressed key

 

Takes the code of the pressed key from the buffer.

Characteristic:

  * eax = 2 - the number of function

Returned value:

  * if the buffer is empty, eax=1 is returned

  * if the buffer is not empty, al=0, ah=key code is returned, bits 16-23 contain the ASCII mode code of the pressed key, scancodes in the mode indicator bits set to zero. Bits 23-31 are reset

  * if there is a" hot key", it is returned al=2, ah=skankod of the pressed key (0 for control keys), the highest word of the eax register contains the state of the control keys when the hotkey is pressed

Comments:

  * There is a 120-byte system-wide keystroke buffer, organized as a queue.

  * There is another system-wide buffer of 120 "hot keys".

  * When this function is called by an application with an inactive window it is considered that a buffer of keys pressed is empty.

  * By default, this function returns ASCII codes; switch to scancode mode (and back) using function 66. However, hotkeys are always returned as scancodes.

  * Find out which key combinations correspond to which codes, you can,by running the keyascii and scancode applications.

  * The codes are returned directly by the keyboard and are fixed; ASCII codes are obtained using conversion tables, which can be set by sub-function 2 functions 21 and read sub-function 2 functions 26.

  * As a result, ASCII codes take into account the current keyboard layout (rus / en) in contrast to the scancodes.

  * Information is received only about the hot keys that have been identified by this stream by sub-function 4 of function 66.

 

Constants for registers:

  eax-SF_GET_KEY (2)