MiniGUI API Reference (MiniGUI-Processes)  v5.0.6
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.

MSG_SYSKEYDOWN
#define MSG_SYSKEYDOWN
User presses down a key when <Alt> key is down.
Definition: window.h:636
MSG_SYSKEYUP
#define MSG_SYSKEYUP
User releases up a key when <Alt> key is down.
Definition: window.h:676
MSG_KEYUP
#define MSG_KEYUP
User releases up a key.
Definition: window.h:616
DWORD
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:604
HWND
GHANDLE HWND
Handle to main window or control.
Definition: common.h:407
MSG_KEYLONGPRESS
#define MSG_KEYLONGPRESS
A key is long pressed.
Definition: window.h:694
FOURTHBYTE
#define FOURTHBYTE(w)
Returns the fourth byte of the WPARAM w.
Definition: common.h:806
WPARAM
UINT_PTR WPARAM
A type definition for the first message paramter.
Definition: common.h:706
LRESULT
LONG_PTR LRESULT
Signed result of message processing.
Definition: common.h:583
UINT
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:664
MSG_KEYSYM
#define MSG_KEYSYM
A key symbol translated from MSG_KEYDOWN messages.
Definition: window.h:737
LOBYTE
#define LOBYTE(w)
Returns the low byte of the word w.
Definition: common.h:720
THIRDBYTE
#define THIRDBYTE(w)
Returns the third byte of the WPARAM w.
Definition: common.h:798
MSG_CHAR
#define MSG_CHAR
A character translated from MSG_KEYDOWN message.
Definition: window.h:596
HIBYTE
#define HIBYTE(w)
Returns the high byte of the word w.
Definition: common.h:728
KS_CTRL
#define KS_CTRL
This status indicate that either the left-Ctrl key or the right-Ctrl key was pressed when the key or ...
Definition: common.h:1697
DefaultMainWinProc
#define DefaultMainWinProc
Is the default main window callback procedure.
Definition: window.h:7383
MSG_UTF8CHAR
#define MSG_UTF8CHAR
A character translated from MSG_KEYDOWN message.
Definition: window.h:761
FIRSTBYTE
#define FIRSTBYTE(w)
Returns the first byte of the WPARAM w.
Definition: common.h:782
MSG_SYSCHAR
#define MSG_SYSCHAR
A system character translated from MSG_SYSKEYDOWN message.
Definition: window.h:656
LPARAM
UINT_PTR LPARAM
A type definition for the second message paramter.
Definition: common.h:712
SECONDBYTE
#define SECONDBYTE(w)
Returns the second byte of the WPARAM w.
Definition: common.h:790
MSG_KEYDOWN
#define MSG_KEYDOWN
User presses a key down.
Definition: window.h:568