MiniGUI API Reference (MiniGUI-Standalone)  v5.0.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Functions
Control creating/destroying

Functions

MG_EXPORT HWND GUIAPI CreateWindowEx2 (const char *spClassName, const char *spCaption, DWORD dwStyle, DWORD dwExStyle, LINT id, int x, int y, int w, int h, HWND hParentWnd, const char *werdr_name, const WINDOW_ELEMENT_ATTR *we_attrs, DWORD dwAddData)
 Creates a child window with extended style, renderer and attributes table. More...
 
static HWND GUIAPI CreateWindowEx (const char *spClassName, const char *spCaption, DWORD dwStyle, DWORD dwExStyle, LINT id, int x, int y, int w, int h, HWND hParentWnd, DWORD dwAddData)
 A shortcut version of CreateWindowEx2. More...
 
MG_EXPORT BOOL GUIAPI DestroyWindow (HWND hWnd)
 Destroys a specified control. More...
 
MG_EXPORT NOTIFPROC GUIAPI SetNotificationCallback (HWND hwnd, NOTIFPROC notif_proc)
 Set a new notification callback procedure for a window. More...
 
MG_EXPORT NOTIFPROC GUIAPI GetNotificationCallback (HWND hwnd)
 Get the notification callback procedure of a control. More...
 

Detailed Description

Function Documentation

◆ CreateWindowEx()

HWND GUIAPI CreateWindowEx ( const char *  spClassName,
const char *  spCaption,
DWORD  dwStyle,
DWORD  dwExStyle,
LINT  id,
int  x,
int  y,
int  w,
int  h,
HWND  hParentWnd,
DWORD  dwAddData 
)
inlinestatic

A shortcut version of CreateWindowEx2.

This function creates a child window by calling CreateWindowEx2 function and passing NULL for both werdr_name and we_attrs parameters.

See also
CreateWindowEx2

Definition at line 9829 of file window.h.

◆ CreateWindowEx2()

HWND GUIAPI CreateWindowEx2 ( const char *  spClassName,
const char *  spCaption,
DWORD  dwStyle,
DWORD  dwExStyle,
LINT  id,
int  x,
int  y,
int  w,
int  h,
HWND  hParentWnd,
const char *  werdr_name,
const WINDOW_ELEMENT_ATTR we_attrs,
DWORD  dwAddData 
)

Creates a child window with extended style, renderer and attributes table.

This function creates a child window (also known as "control") with extended style, renderer and attributes table. It specifies the window class, the window title, the window style, the window extended style, the initial position, and the size of the window, etc. The function also specifies the window's parent or owner.

Parameters
spClassNameThe class name of the control.
spCaptionThe caption of the control.
dwStyleThe control style.
dwExStyleThe extended control style.
idThe identifier of the control.
xx,y: The initial position of the control in the parent window.
yx,y: The initial position of the control in the parent window.
wThe initial width of the control.
hThe initial height of the control.
hParentWndThe handle to the parent window.
werdr_nameThe window renderer name. NULL for default renderer.
we_attrsThe pointer to window element attribute table. NULL for default attribute table.
dwAddDataThe first private additional data of the control. Note that some control classes use this value to initialize some properties of the new control instance. For these control classes, you should pass a valid value to it.
Returns
The handle to the new control, HWND_INVALID on error.
See also
CreateWindowEx, CreateMainWindow, CTRLDATA

◆ DestroyWindow()

BOOL GUIAPI DestroyWindow ( HWND  hWnd)

Destroys a specified control.

This function destroys the specified control hWnd, which is created by CreateWindowEx or CreateWindowEx2.

Parameters
hWndThe handle to the control.
Returns
TRUE on success, FALSE on error.
See also
CreateWindowEx

◆ GetNotificationCallback()

NOTIFPROC GUIAPI GetNotificationCallback ( HWND  hwnd)

Get the notification callback procedure of a control.

This function gets the new notification callback procedure of the control of hwnd.

Parameters
hwndThe handle to the control.
Returns
The notification callback procedure.
See also
NOTIFPROC, SetNotificationCallback

◆ SetNotificationCallback()

NOTIFPROC GUIAPI SetNotificationCallback ( HWND  hwnd,
NOTIFPROC  notif_proc 
)

Set a new notification callback procedure for a window.

This function sets the new notification callback procedure (notif_proc) for the specified window hwnd.

In the early versions, the notification message will be sent to the target window as a MSG_COMMAND message.

Since version 1.2.6, MiniGUI defines the Notification Callback Procedure for a window. You can specify a callback function for a window by calling SetNotificationCallback to receive and handle the notifications from its children in the procedure.

Since version 5.0.0, the notification callback procedure also works for a main window or a virtual window.

If you did not set the notification callback function of the target window, you must handle MSG_COMMAND message in the window procedure of the target window. However, due to historical reasons, MSG_COMMAND has the following restrictions:

  • The additional data you specified when calling NotifyWindow or NotifyParentEx will be lost.
  • The value of the identifier and the notification code cannot exceed a WORD.
Parameters
hwndThe handle to the window.
notif_procThe new notification callback procedure, can be NULL.
Returns
The old notification callback procedure.
See also
NOTIFPROC, GetNotificationCallback, NotifyWindow, NotifyParentEx