MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Functions
Asynchronous key status functions

Functions

MG_EXPORT BOOL GUIAPI GetKeyStatus (UINT uKey)
 Get a key or a mouse button status. More...
 
MG_EXPORT DWORD GUIAPI GetShiftKeyStatus (void)
 Get status of the shift keys. More...
 
MG_EXPORT void GUIAPI GetKeyboardState (BYTE *kbd_state)
 Get status of all keys on keyboard. More...
 

Detailed Description

Function Documentation

◆ GetKeyboardState()

void GUIAPI GetKeyboardState ( BYTE kbd_state)

Get status of all keys on keyboard.

This function gets the status of all keys on keyboard.

The scancodes of all keys are defined in <minigui/common.h>.

Parameters
kbd_stateThe buffer returns the current status of all keys. Note that the length of the buffer should be larger than (MGUI_NR_KEYS + 1).
See also
GetKeyStatus, MGUI_NR_KEYS

◆ GetKeyStatus()

BOOL GUIAPI GetKeyStatus ( UINT  uKey)

Get a key or a mouse button status.

This function gets a key or a mouse button status, returns TRUE when pressed, or FALSE when released. uKey indicates the key or mouse button. For keys on keyboard, uKey should be the scancode of the key, for mouse button, uKey should be one value of the following:

  • SCANCODE_LEFTBUTTON
    Left mouse button.
  • SCANCODE_MIDDLBUTTON
    Middle mouse button.
  • SCANCODE_RIGHTBUTTON
    Right mouse button.

These constants and the scancodes of keys are defined in <minigui/common.h>.

Parameters
uKeyIndicates the key or mouse button.
Returns
Returns TRUE when pressed, or FALSE when released.
See also
GetShiftKeyStatus

◆ GetShiftKeyStatus()

DWORD GUIAPI GetShiftKeyStatus ( void  )

Get status of the shift keys.

This function gets ths status of the shift keys, the returned value indicates the status of shift keys – CapsLock, ScrollLock, NumLock, Left Shift, Right Shift, Left Ctrl, Right Ctrl, Left Alt, and Right Alt. You can use KS_* ORed with the status value to determine one shift key's status:

  • KS_CAPSLOCK
    Indicates that CapsLock is locked.
  • KS_NUMLOCK
    Indicates that NumLock is locked.
  • KS_SCROLLLOCK
    Indicates that ScrollLock is locked.
  • KS_LEFTCTRL
    Indicates that left Ctrl key is pressed.
  • KS_RIGHTCTRL
    Indicates that right Ctrl key is pressed.
  • KS_CTRL
    Indicates that either left or right Ctrl key is pressed.
  • KS_LEFTALT
    Indicates that left Alt key is pressed.
  • KS_RIGHTALT
    Indicates that right Alt key is pressed.
  • KS_ALT
    Indicates that either left or right Alt key is pressed.
  • KS_LEFTSHIFT
    Indicates that left Shift key is pressed.
  • KS_RIGHTSHIFT
    Indicates that right Shift key is pressed.
  • KS_SHIFT
    Indicates that either left or right Shift key is pressed.

These constants are defined in <minigui/common.h>.

Returns
The status of the shift keys.
See also
Macros for key codes and shift status