MiniGUI API Reference (MiniGUI-Standalone)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Data Structures | |
struct | _MSG |
Macros | |
#define | PM_NOREMOVE 0x0000 |
#define | PM_REMOVE 0x0001 |
#define | PM_NOYIELD 0x0002 |
Typedefs | |
typedef struct _MSG | MSG |
Functions | |
MG_EXPORT BOOL GUIAPI | PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax, BOOL bWait, UINT uRemoveMsg) |
Peek a message from the message queue of a main window. More... | |
static BOOL GUIAPI | GetMessage (PMSG pMsg, HWND hWnd) |
Get a message from the message queue of a main window. More... | |
MG_EXPORT BOOL GUIAPI | WaitMessage (PMSG pMsg, HWND hMainWnd) |
Wait for a message from the message queue of a main window. More... | |
MG_EXPORT BOOL GUIAPI | HavePendingMessage (HWND hMainWnd) |
Check if there is any pending message in the message queue of a main window. More... | |
static BOOL GUIAPI | PeekMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax, UINT uRemoveMsg) |
Peek a message from the message queue of a main window. More... | |
MG_EXPORT BOOL GUIAPI | PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax, UINT uRemoveMsg) |
Peek a post message from the message queue of a main window. More... | |
MG_EXPORT int GUIAPI | PostMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Posts a message into the message queue of a window and returns immediatly. More... | |
MG_EXPORT LRESULT GUIAPI | SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Send a message to a window and wait for the handling result. More... | |
MG_EXPORT void GUIAPI | SetAutoRepeatMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
Set the auto-repeat message. More... | |
MG_EXPORT LRESULT GUIAPI | PostSyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Post a synchronical message to a window which is in different thread. More... | |
MG_EXPORT LRESULT GUIAPI | SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Send an asynchronical message to a window. More... | |
MG_EXPORT int GUIAPI | SendNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Send a notification message to a window. More... | |
MG_EXPORT int GUIAPI | SendPriorNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) |
Send a prior notification message to a window. More... | |
MG_EXPORT int GUIAPI | NotifyWindow (HWND hWnd, LINT id, int code, DWORD dwAddData) |
Send a notification message to a window. More... | |
MG_EXPORT int GUIAPI | BroadcastMessage (UINT nMsg, WPARAM wParam, LPARAM lParam) |
Broadcast a message to all main windows on the desktop. More... | |
MG_EXPORT int GUIAPI | BroadcastMessageInThisThread (UINT nMsg, WPARAM wParam, LPARAM lParam) |
Broadcast a message to all main/virtual windows in the current thread. More... | |
MG_EXPORT int GUIAPI | PostQuitMessage (HWND hWnd) |
Puts a MSG_QUIT message into the message queue of a main window. More... | |
MG_EXPORT BOOL GUIAPI | SetKeyboardLayout (const char *kbd_layout) |
Set a new keyboard layout. More... | |
MG_EXPORT BOOL GUIAPI | TranslateMessage (PMSG pMsg) |
Translates key down and key up messages to MSG_CHAR message and post it into the message queue. More... | |
MG_EXPORT BOOL GUIAPI | TranslateKeyMsgToChar (int message, WPARAM wParam, LPARAM lParam, WORD *ch) |
Translates a key down and key up message to a corresponding character. More... | |
MG_EXPORT LRESULT GUIAPI | DispatchMessage (PMSG pMsg) |
Dispatches a message to the window's callback procedure. More... | |
MG_EXPORT int GUIAPI | ThrowAwayMessages (HWND pMainWnd) |
Removes all messages in the message queue associated with a window. More... | |
MG_EXPORT BOOL GUIAPI | EmptyMessageQueue (HWND hWnd) |
Empty a message queue. More... | |
#define PM_NOREMOVE 0x0000 |
#define PM_NOYIELD 0x0002 |
#define PM_REMOVE 0x0001 |
The message structure.
Broadcast a message to all main windows on the desktop.
This function posts the message specified by (nMsg, wParam, lParam) to all the main windows on the desktop.
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Broadcast a message to all main/virtual windows in the current thread.
This function posts the message specified by (nMsg, wParam, lParam) to all the main/virtual windows in the current thread.
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Dispatches a message to the window's callback procedure.
This function dispatches the message pointed to by pMsg to the target window's callback procedure.
pMsg | The pointer to the message. |
Example:
Empty a message queue.
This function empties the message queue which is used by the window specified by hWnd.
hWnd | The handle to the main window. |
Get a message from the message queue of a main window.
This function gets a message from the message queue of the main window hMainWnd, and returns until there is a message in the message queue.
pMsg | Pointer to the result message. |
hMainWnd | Handle to the window. |
Example:
Check if there is any pending message in the message queue of a main window.
This function checks whether there is any pending message in the message queue of the main window hMainWnd.
hMainWnd | The handle to the main window. |
Send a notification message to a window.
This function sends a notification message to the target window hWnd. By default, the notification will be packed as a MSG_NOTIFICATION message and be sent to the target window. This function will return immediately after putting the message to the message queue of the target window.
If you have set the notification callback procedure for the target window, DispatchMessage will call the procedure in the context of the thread of that window, otherwise, the function will convert this message to a MSG_COMMAND message and dispatch the MSG_COMMAND message to the window procedure.
hWnd | The handle to target window. |
id | The identifier of the source. |
code | The notification code. |
dwAddData | The additional data of the notification. |
Since 5.0.0
|
inlinestatic |
Peek a message from the message queue of a main window.
This function peeks a message from the message queue of the window hWnd and returns immediatly. Unlike GetMessage, this function does not wait for a message.
pMsg | Pointer to the result message. |
hWnd | The handle to the window. |
nMsgFilterMin | The min identifier of the message that should be peeked. |
nMsgFilterMax | The max identifier of the message that should be peeked. |
uRemoveMsg | Whether remove the message from the message queue. Should be the following values:
|
BOOL PeekMessageEx | ( | PMSG | pMsg, |
HWND | hWnd, | ||
UINT | nMsgFilterMin, | ||
UINT | nMsgFilterMax, | ||
BOOL | bWait, | ||
UINT | uRemoveMsg | ||
) |
Peek a message from the message queue of a main window.
This function peeks a message from the message queue of the window hWnd; if bWait is TRUE, it will wait for the message, else return immediatly.
pMsg | Pointer to the result message. |
hWnd | The handle to the window. |
nMsgFilterMin | The min identifier of the message that should be peeked. |
nMsgFilterMax | The max identifier of the message that should be peeked. |
bWait | Whether to wait for a message. |
uRemoveMsg | Whether remove the message from the message queue. Should be the following values:
|
BOOL PeekPostMessage | ( | PMSG | pMsg, |
HWND | hWnd, | ||
UINT | nMsgFilterMin, | ||
UINT | nMsgFilterMax, | ||
UINT | uRemoveMsg | ||
) |
Peek a post message from the message queue of a main window.
This function peeks a message from the message queue of the window hWnd and returns immediatly. Unlike PeekMessage, this function only peek a post message.
pMsg | Pointer to the result message. |
hWnd | The handle to the window. |
nMsgFilterMin | The min identifier of the message that should be peeked. |
nMsgFilterMax | The max identifier of the message that should be peeked. |
uRemoveMsg | Whether remove the message from the message queue. Should be the following values:
|
Posts a message into the message queue of a window and returns immediatly.
This function posts a message into the message queue of the window hWnd and returns immediately.
hWnd | The handle to the window. |
nMsg | The identifier of the message. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
ERR_OK | Post message successfully. |
ERR_QUEUE_FULL | The message queue is full. |
ERR_INV_HWND | Invalid window handle. |
int PostQuitMessage | ( | HWND | hWnd | ) |
Puts a MSG_QUIT message into the message queue of a main window.
This function puts a MSG_QUIT message into the message queue of the main window hWnd. The next call to GetMessage will return 0.
hWnd | The handle to the main window. |
Post a synchronical message to a window which is in different thread.
This function posts the synchronical message specified by (nMsg, wParam, lParam) to the window hWnd which is in a different thread. This function will return until the message is handled by the window procedure of that window.
hWnd | The handle to the window. |
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Send an asynchronical message to a window.
This function sends the asynchronical message specified by (nMsg, wParam, lParam) to the window hWnd which might be in a different thread. This function calls the window procedure immediately, so it is very dangerous. You should make sure that the message handler is thread safe.
hWnd | The handle to the window. |
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Send a message to a window and wait for the handling result.
This function sends a message to the window hWnd, and will return until the message-handling process returns.
hWnd | The handle to the window. |
nMsg | The identifier of the message. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
ERR_INV_HWND | Invalid window handle. |
ERR_MSG_CANCELED | The message handling was canceled by the target window. This may occur when the target window which is running in another thread is destroyed. |
Send a notification message to a window.
This function sends the notification message specified by (nMsg, wParam, lParam) to the window hWnd. This function puts the notification message at the tail of the message queue and returns immediately.
hWnd | The handle to the window. |
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Send a prior notification message to a window.
This function sends the notification message specified by (nMsg, wParam, lParam) to the window hWnd. This function puts the notification message at the head of the message queue and returns immediately.
hWnd | The handle to the window. |
nMsg | The message identifier. |
wParam | The first parameter of the message. |
lParam | The second parameter of the message. |
Set the auto-repeat message.
This function sets the auto-repeat message. When the default message procedure receives an MSG_IDLE message, the default handler will send the auto-repeat message to the target window as a notification message.
hwnd | The handle to the target window. Set it to zero to disable the auto-repeat message. |
msg | The identifier of the auto-repeat message. |
wParam | The first parameter of the auto-repeat message. |
lParam | The second parameter of the auto-repeat message. |
BOOL SetKeyboardLayout | ( | const char * | kbd_layout | ) |
Set a new keyboard layout.
This function sets the keymaps to translate key scancodes to MSG_CHAR or MSG_KEYSYM messages. The default keymaps is for US PC keyboard layout, you can call this function to set a different keyboard layout. The argument of kbd_layout specifies the name of the keyboard layout.
kbd_layout | The keyboard layout name. It can be one of the following values: |
int ThrowAwayMessages | ( | HWND | pMainWnd | ) |
Removes all messages in the message queue associated with a window.
This function removes all messages which are associated with the specified window pMainWnd.
pMainWnd | The handle to the window. |
Translates a key down and key up message to a corresponding character.
This function translates a key down and key up message to a character. If the message is not a key message, this function does nothing.
The behavior of this function is inflected by the current keyboard layout. The default keyboard layout is US PC keyboard, but you can call SetKeyboardLayout function to set a different keyboard layout.
message | The type of message. |
wParam | Message parameter. |
lParam | Message parameter. |
ch | A string buffer for storing translated characters. |
Translates key down and key up messages to MSG_CHAR message and post it into the message queue.
This function translates key down and key up message to an MSG_CHAR message or some MSG_KEYSYM messages, and send the message(s) to the window procedure as a notification message. If the message is not a key message, this function does nothing.
The behavior of this function is inflected by the current keyboard layout. The default keyboard layout is US PC keyboard, but you can call SetKeyboardLayout function to set a different keyboard layout.
pMsg | The pointer of message. |
Wait for a message from the message queue of a main window.
This function waits for a message from the message queue of the main window hMainWnd, and returns until there is a message in the message queue. Unlike GetMessage, this function does not remove the message from the message queue.
pMsg | Pointer to the result message. |
hMainWnd | Handle to the window. |