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

Macros

#define MSG_KEYDOWN   0x0010
 User presses a key down. More...
 
#define MSG_CHAR   0x0011
 A character translated from MSG_KEYDOWN message. More...
 
#define MSG_KEYUP   0x0012
 User releases up a key. More...
 
#define MSG_SYSKEYDOWN   0x0013
 User presses down a key when <Alt> key is down. More...
 
#define MSG_SYSCHAR   0x0014
 A system character translated from MSG_SYSKEYDOWN message. More...
 
#define MSG_SYSKEYUP   0x0015
 User releases up a key when <Alt> key is down. More...
 
#define MSG_KEYLONGPRESS   0x0016
 A key is long pressed. More...
 
#define MSG_KEYALWAYSPRESS   0x0017
 A key is always pressed. More...
 
#define MSG_KEYSYM   0x0018
 A key symbol translated from MSG_KEYDOWN messages. More...
 
#define MSG_UTF8CHAR   0x0019
 A character translated from MSG_KEYDOWN message. More...
 
#define DEF_LPRESS_TIME   500
 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

#define DEF_APRESS_TIME   1000

Default always pressed time of a key.

See also
MSG_KEYALWAYSPRESS

Definition at line 608 of file window.h.

#define DEF_INTERVAL_TIME   200

Default send MSG_KEYLONGPRESS in interval value.

Definition at line 614 of file window.h.

#define DEF_LPRESS_TIME   500

Default long pressed time of a key.

See also
MSG_KEYLONGPRESS

Definition at line 600 of file window.h.

#define MSG_CHAR   0x0011

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.

1 MSG_CHAR
2 unsigned char ch_buff [4];
3 unsigned char ch_buff [0] = FIRSTBYTE(wParam);
4 unsigned char ch_buff [1] = SECONDBYTE(wParam);
5 unsigned char ch_buff [2] = THIRDBYTE(wParam);
6 unsigned char ch_buff [3] = FOURTHBYTE(wParam);
7 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 440 of file window.h.

#define MSG_KEYALWAYSPRESS   0x0017

A key is always pressed.

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

Definition at line 541 of file window.h.

#define MSG_KEYDOWN   0x0010

User presses a key down.

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

1 MSG_KEYDOWN
2 int scancode = (int)wParam;
3 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 412 of file window.h.

#define MSG_KEYLONGPRESS   0x0016

A key is long pressed.

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

Definition at line 532 of file window.h.

#define MSG_KEYSYM   0x0018

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~".

1 MSG_KEYSYM
2 int index = HIBYTE (wParam);
3 int keysym = LOBYTE (wParam);
4 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 568 of file window.h.

#define MSG_KEYUP   0x0012

User releases up a key.

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

1 MSG_KEYUP
2 int scancode = (int)wParam;
3 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 460 of file window.h.

#define MSG_SYSCHAR   0x0014

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.

1 MSG_SYSCHAR
2 int ch = (int)wParam;
3 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 500 of file window.h.

#define MSG_SYSKEYDOWN   0x0013

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.

1 MSG_SYSKEYDOWN
2 int scancode = (int)wParam;
3 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 480 of file window.h.

#define MSG_SYSKEYUP   0x0015

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.

1 MSG_SYSKEYUP
2 int scancode = (int)wParam;
3 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 520 of file window.h.

#define MSG_UTF8CHAR   0x0019

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.

1 MSG_UTF8CHAR
2 unsigned char ch_utf8 [6];
3 unsigned char ch_utf8 [0] = FIRSTBYTE(wParam);
4 unsigned char ch_utf8 [1] = SECONDBYTE(wParam);
5 unsigned char ch_utf8 [2] = THIRDBYTE(wParam);
6 unsigned char ch_utf8 [3] = FOURTHBYTE(wParam);
7 unsigned char ch_utf8 [4] = FIRSTBYTE(lParam);
8 unsigned char 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 592 of file window.h.

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

User set default interval time that MSG_KEYLONGPRESS is sent.

Definition at line 642 of file window.h.

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

User set default always pressed time of a key.

Definition at line 633 of file window.h.

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

User set default long pressed time of a key.

Definition at line 624 of file window.h.