MiniGUI API Reference (MiniGUI-Processes)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Typedefs | Functions
Message or event hook functions

Typedefs

typedef int(* MSGHOOK) (void *context, HWND dst_wnd, UINT msg, WPARAM wparam, LPARAM lparam)
 Type of message hook function. More...
 
typedef int(* SRVEVTHOOK) (PMSG pMsg)
 The type of the event hook. More...
 

Functions

MG_EXPORT MSGHOOK GUIAPI RegisterEventHookFunc (int event_type, MSGHOOK hook, void *context)
 Registers an input event message hook function. More...
 
static MSGHOOK GUIAPI RegisterKeyMsgHook (void *context, MSGHOOK hook)
 Register a key message hook function. More...
 
static MSGHOOK GUIAPI RegisterMouseMsgHook (void *context, MSGHOOK hook)
 Register a mouse message hook function. More...
 
MG_EXPORT BOOL GUIAPI RegisterEventHookWindow (HWND hwnd, DWORD flags)
 Register an input event message hook window. More...
 
MG_EXPORT BOOL GUIAPI UnregisterEventHookWindow (HWND hwnd)
 Unregister an input event message hook window. More...
 
MG_EXPORT HWND GUIAPI RegisterKeyHookWindow (HWND hwnd, DWORD flag)
 Register a key message hook window. More...
 
MG_EXPORT HWND GUIAPI RegisterMouseHookWindow (HWND hwnd, DWORD flag)
 Registers a mouse message hook window. More...
 
MG_EXPORT SRVEVTHOOK GUIAPI SetServerEventHook (SRVEVTHOOK SrvEvtHook)
 Set an event hook in the server of MiniGUI-Processes. More...
 

Detailed Description

Typedef Documentation

◆ MSGHOOK

typedef int(* MSGHOOK)(void *context, HWND dst_wnd, UINT msg, WPARAM wparam, LPARAM lparam)

Type of message hook function.

This is the type of a message hook function.

Parameters
contextThe context which was set when you registered the hook function.
dst_wndThe handle of the original destination window of the message.
msgThe message identifier.
wparamThe first parameter of the message.
lparamThe second paramter of the message.
Returns
A value indicating stopping or continuing the subsequent handling of the message, can be one of the following values:
  • HOOK_GOON
    Indicate continuing to handle the message.
  • HOOK_STOP
    Indicate stopping to handle the message.

Definition at line 4026 of file window.h.

◆ SRVEVTHOOK

typedef int(* SRVEVTHOOK)(PMSG pMsg)

The type of the event hook.

You can call SetServerEventHook to set an event hook in the server of the MiniGUI-Processes or under MiniGUI-Standalone runtime mode.

If the event hook returns HOOK_GOON, MiniGUI will continue to handle the event, and post it to the active client. If the hook returns HOOK_STOP, MiniGUI will cancel subsequent handling.

Note
Deprecated since 5.0.0; Use RegisterEventHookFunc() instead.
See also
SetServerEventHook, RegisterEventHookFunc

Definition at line 4213 of file window.h.

Function Documentation

◆ RegisterEventHookFunc()

MSGHOOK GUIAPI RegisterEventHookFunc ( int  event_type,
MSGHOOK  hook,
void *  context 
)

Registers an input event message hook function.

This function registers an input event message hook function pointed to by hook. When the desktop receives an input event message with the specified event type event_type, it will call the hook function first, and passes the context value to the hook as the first argument.

Parameters
event_typeWhich type of event to be hooked. The value of this argument should be a one of the following values:
  • HOOK_EVENT_KEY
    To hook all key events.
  • HOOK_EVENT_MOUSE
    To hook all mouse events.
  • HOOK_EVENT_EXTRA
    To hook all extra input events.
hookThe pointer to the hook function. This function will unregister the old hook for the specified event type if hook is NULL.
contextThe context value will be passed to the hook function.
Returns
The pointer to the old hook function for the specified event type.
Note
The hook function will be called in the context of desktop or event thread. you should note the thread safety when implementing the hook function.
See also
RegisterEventHookWindow, MSGHOOK

Since 5.0.0

◆ RegisterEventHookWindow()

BOOL GUIAPI RegisterEventHookWindow ( HWND  hwnd,
DWORD  flags 
)

Register an input event message hook window.

This function registers the specified window hwnd as an input event message hook window. When MiniGUI receives an input event message, it will post it to the hook window first.

Parameters
hwndThe hook hwnd.
flagsThe flags indicating the event types hooked event and whether stop or continue handling the hooked events. The value of this argument should be OR'd with one or more event types and HOOK_GOON or HOOK_STOP:
  • HOOK_EVENT_KEY
    To hook all key events.
  • HOOK_EVENT_MOUSE
    To hook all mouse events.
  • HOOK_EVENT_EXTRA
    To hook all extra input events.
  • HOOK_GOON
    Indicate continuing to handle the message.
  • HOOK_STOP
    Indicate stopping to handle the message.
Returns
The handle of old hook window.
Note
This function be be called by a client of MiniGUI-Processes. For the server, you can use SetServerEventHook.
See also
UnregisterEventHookWindow

Since 5.0.0.

◆ RegisterKeyHookWindow()

HWND GUIAPI RegisterKeyHookWindow ( HWND  hwnd,
DWORD  flag 
)

Register a key message hook window.

This function registers a window specified by hwnd as the key message hook window. When MiniGUI receives a key message, it will post it to the hooked window first.

Parameters
hwndThe handle of the hook window. This function will unregister the old hook if hwnd is HWND_NULL.
flagIndicating whether stop or continue handling the hooked messages; HOOK_GOON to continue, HOOK_STOP to stop.
Returns
The handle of old hook window.
See also
UnregisterEventHookWindow, RegisterMouseHookWindow

◆ RegisterKeyMsgHook()

MSGHOOK GUIAPI RegisterKeyMsgHook ( void *  context,
MSGHOOK  hook 
)
inlinestatic

Register a key message hook function.

This function registers a key message hook pointed to by hook. When the desktop receives a key message, it will call the hook function first, and passes the context value to the hook as the first argument.

Parameters
contextThe context value will be passed to the hook.
hookThe pointer to the hook function. This function will unregister the old hook if hook is NULL.
Returns
The pointer to the old hook function.
See also
RegisterEventHookFunc, MSGHOOK

Definition at line 4080 of file window.h.

◆ RegisterMouseHookWindow()

HWND GUIAPI RegisterMouseHookWindow ( HWND  hwnd,
DWORD  flag 
)

Registers a mouse message hook window.

This function registers a window specified by hwnd as the mouse message hook window. When MiniGUI receives a mouse message, it will post it to the hooked window first.

Parameters
hwndThe handle of the hook window. This function will unregister the old hook if hwnd is HWND_NULL.
flagIndicating whether stop or continue handling the hooked messages; HOOK_GOON to continue, HOOK_STOP to stop.
Returns
The handle of old hook window.
See also
UnregisterEventHookWindow, RegisterMouseHookWindow

◆ RegisterMouseMsgHook()

MSGHOOK GUIAPI RegisterMouseMsgHook ( void *  context,
MSGHOOK  hook 
)
inlinestatic

Register a mouse message hook function.

This function registers a mouse message hook pointed to by hook. When the desktop receives a mouse message, it will call the hook function first, and passes the context value to the hook as the first argument.

Parameters
contextThe context value will be passed to the hook function.
hookThe pointer to the hook function. This function will unregister the old hook if hook is NULL.
Returns
The pointer to the old hook function.
See also
RegisterEventHookFunc, MSGHOOK

Definition at line 4101 of file window.h.

◆ SetServerEventHook()

SRVEVTHOOK GUIAPI SetServerEventHook ( SRVEVTHOOK  SrvEvtHook)

Set an event hook in the server of MiniGUI-Processes.

This function sets the event hook as SrvEvtHook for the server of MiniGUI-Processes or MiniGUI-Standalone.

Parameters
SrvEvtHookThe pointer to the hook, NULL to cancel the hook.
Returns
The old hook function.
Note
Only available for MiniGUI-Processes and MiniGUI-Standalone runtime modes. Under MiniGUI-Processes, only the server can call this function.
Deprecated since 5.0.0; Use RegisterEventHookFunc() instead.
See also
SRVEVTHOOK, RegisterEventHookFunc

◆ UnregisterEventHookWindow()

BOOL GUIAPI UnregisterEventHookWindow ( HWND  hwnd)

Unregister an input event message hook window.

This function unregisters the specified window hwnd from the hook list.

Parameters
hwndThe hook hwnd.
Returns
TRUE on success, otherwise FALSE.
See also
RegisterEventHookWindow

Since 5.0.0.