MiniGUI API Reference (MiniGUI-Standalone)  v5.0.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros
Key event messages

Macros

#define MSG_KEYDOWN   0x0015
 User presses a key down. More...
 
#define MSG_CHAR   0x0016
 A character translated from MSG_KEYDOWN message. More...
 
#define MSG_KEYUP   0x0017
 User releases up a key. More...
 
#define MSG_SYSKEYDOWN   0x0018
 User presses down a key when <Alt> key is down. More...
 
#define MSG_SYSCHAR   0x0019
 A system character translated from MSG_SYSKEYDOWN message. More...
 
#define MSG_SYSKEYUP   0x001A
 User releases up a key when <Alt> key is down. More...
 
#define MSG_KEYLONGPRESS   0x001B
 A key is long pressed. More...
 
#define MSG_KEYALWAYSPRESS   0x001C
 A key is always pressed. More...
 
#define MSG_KEYSYM   0x001D
 A key symbol translated from MSG_KEYDOWN messages. More...
 
#define MSG_UTF8CHAR   0x001E
 A character translated from MSG_KEYDOWN message. More...
 
#define DEF_LPRESS_TIME   200
 Default long pressed time of a key. More...
 
#define DEF_APRESS_TIME   1000
 Default always pressed time of a key. More...
 
#define DEF_INTERVAL_TIME   200
 Default send MSG_KEYLONGPRESS in interval value. More...
 
#define SetKeyLongPressTime(time)
 User set default long pressed time of a key. More...
 
#define SetKeyAlwaysPressTime(time)
 User set default always pressed time of a key. More...
 
#define SetIntervalTime(time)
 User set default interval time that MSG_KEYLONGPRESS is sent. More...
 

Detailed Description

Macro Definition Documentation

◆ DEF_APRESS_TIME

#define DEF_APRESS_TIME   1000

Default always pressed time of a key.

See also
MSG_KEYALWAYSPRESS

Definition at line 777 of file window.h.

◆ DEF_INTERVAL_TIME

#define DEF_INTERVAL_TIME   200

Default send MSG_KEYLONGPRESS in interval value.

Definition at line 783 of file window.h.

◆ DEF_LPRESS_TIME

#define DEF_LPRESS_TIME   200

Default long pressed time of a key.

See also
MSG_KEYLONGPRESS

Definition at line 769 of file window.h.

◆ MSG_CHAR

#define MSG_CHAR   0x0016

A character translated from MSG_KEYDOWN message.

This message is translated from a MSG_KEYDOWN message by TranslateMessage and sent to the current active window.

unsigned char ch_buff [4];
ch_buff [0] = FIRSTBYTE(wParam);
ch_buff [1] = SECONDBYTE(wParam);
ch_buff [2] = THIRDBYTE(wParam);
ch_buff [3] = FOURTHBYTE(wParam);
DWORD key_flags = (DWORD)lParam;
Parameters
ch_buffThe buffer to store the bytes of the character.
key_flagsThe shift key status when this message occurred.
Note
Please use FIRSTBYTE ~ FOURTHBYTE to get the bytes if the character is a multi-byte character. Use MSG_UTF8CHAR to handle the characters encoded in UTF-8.
See also
MSG_SYSCHAR, TranslateMessage, Macros for key codes and shift status

Definition at line 596 of file window.h.

◆ MSG_KEYALWAYSPRESS

#define MSG_KEYALWAYSPRESS   0x001C

A key is always pressed.

This message is sent when a key is pressed to exceed user-defined always time value.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;

Definition at line 710 of file window.h.

◆ MSG_KEYDOWN

#define MSG_KEYDOWN   0x0015

User presses a key down.

This message is posted to the current active window when the user presses a key down.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;
Parameters
scancodeThe scan code of the pressed key.
key_flagsThe shift key status when this message occurred.
See also
MSG_KEYUP, Macros for key codes and shift status

Example:

/*
* This example trys to handle the event when the user
* presses <C> key as the <Ctrl> key is down.
*/
LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
if (wParam ==SCANCODE_C && lParam & KS_CTRL) {
// User pressed Ctrl+C.
break;
}
break;
...
}
return DefaultMainWinProc (hWnd, message, wParam, lParam);
}

Definition at line 568 of file window.h.

◆ MSG_KEYLONGPRESS

#define MSG_KEYLONGPRESS   0x001B

A key is long pressed.

This message is sent when a key is pressed exceed user-defined long time value.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;

Definition at line 694 of file window.h.

◆ MSG_KEYSYM

#define MSG_KEYSYM   0x001D

A key symbol translated from MSG_KEYDOWN messages.

This message is translated from a MSG_KEYDOWN message by TranslateMessage and sent to the current active window.

Note that one translation may generate a key symbol made by more than one character, e.g., when using default keymap, DEL key will generate the key symbol "^[[3~".

int index = HIBYTE (wParam);
int keysym = LOBYTE (wParam);
DWORD key_flags = (DWORD)lParam;
Parameters
indexThe index of the key symbol in one translation, zero for a new translation, and the keysym is the first symbol.
keysymThe code of the key symbol.
key_flagsThe shift key status when this message occurred.
See also
MSG_SYSCHAR, TranslateMessage, Macros for key codes and shift status

Definition at line 737 of file window.h.

◆ MSG_KEYUP

#define MSG_KEYUP   0x0017

User releases up a key.

This message is posted to the current active window when the user releases up a key.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;
Parameters
scancodeThe scan code of the released key.
key_flagsThe shift key status when this message occurred.
See also
MSG_KEYDOWN, Macros for key codes and shift status

Definition at line 616 of file window.h.

◆ MSG_SYSCHAR

#define MSG_SYSCHAR   0x0019

A system character translated from MSG_SYSKEYDOWN message.

This message is translated from a MSG_SYSKEYDOWN message by TranslateMessage and sent to the current active window.

int ch = (int)wParam;
DWORD key_flags = (DWORD)lParam;
Parameters
chThe ASCII code of the pressed key.
key_flagsThe shift key status when this message occurred.
See also
MSG_CHAR, TranslateMessage, Macros for key codes and shift status

Definition at line 656 of file window.h.

◆ MSG_SYSKEYDOWN

#define MSG_SYSKEYDOWN   0x0018

User presses down a key when <Alt> key is down.

This message is posted to the current active window when the user presses down a key as <Alt> key is down.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;
Parameters
scancodeThe scan code of the pressed key.
key_flagsThe shift key status when this message occurred.
See also
MSG_SYSKEYUP, MSG_SYSCHAR, Macros for key codes and shift status

Definition at line 636 of file window.h.

◆ MSG_SYSKEYUP

#define MSG_SYSKEYUP   0x001A

User releases up a key when <Alt> key is down.

This message is posted to the current active window when the user releases up a key as <Alt> key is down.

int scancode = (int)wParam;
DWORD key_flags = (DWORD)lParam;
Parameters
scancodeThe scan code of the released key.
key_flagsThe shift key status when this message occurred.
See also
MSG_SYSKEYDOWN, Macros for key codes and shift status

Definition at line 676 of file window.h.

◆ MSG_UTF8CHAR

#define MSG_UTF8CHAR   0x001E

A character translated from MSG_KEYDOWN message.

This message generally sent by a IME window to the current active window. The chararcter will be encoded in UTF-8.

unsigned char ch_utf8 [6];
ch_utf8 [0] = FIRSTBYTE(wParam);
ch_utf8 [1] = SECONDBYTE(wParam);
ch_utf8 [2] = THIRDBYTE(wParam);
ch_utf8 [3] = FOURTHBYTE(wParam);
ch_utf8 [4] = FIRSTBYTE(lParam);
ch_utf8 [5] = SECONDBYTE(lParam);
Parameters
ch_utf8The buffer to save the character in UTF-8.
See also
MSG_CHAR, Macros for key codes and shift status

Definition at line 761 of file window.h.

◆ SetIntervalTime

#define SetIntervalTime (   time)
Value:
do { \
__mg_interval_time = time; \
} while (0)

User set default interval time that MSG_KEYLONGPRESS is sent.

Definition at line 811 of file window.h.

◆ SetKeyAlwaysPressTime

#define SetKeyAlwaysPressTime (   time)
Value:
do { \
__mg_key_alwayspress_time = time; \
} while (0)

User set default always pressed time of a key.

Definition at line 802 of file window.h.

◆ SetKeyLongPressTime

#define SetKeyLongPressTime (   time)
Value:
do { \
__mg_key_longpress_time = time; \
} while (0)

User set default long pressed time of a key.

Definition at line 793 of file window.h.