MiniGUI API Reference (MiniGUI-Processes)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Data Structures | Macros | Typedefs | Functions
Dialog operations

Data Structures

struct  _CTRLDATA
 
struct  _DLGTEMPLATE
 

Macros

#define DLGC_WANTARROWS   0x0001
 Control wants arrow keys. More...
 
#define DLGC_WANTTAB   0x0002
 Control wants tab keys. More...
 
#define DLGC_WANTALLKEYS   0x0004
 Control wants all keys. More...
 
#define DLGC_WANTCHARS   0x0008
 Want MSG_CHAR messages. More...
 
#define DLGC_WANTENTER   0x0010
 Control wants enter keys. More...
 
#define DLGC_HASSETSEL   0x0080
 Understands EM_SETSEL message. More...
 
#define DLGC_DEFPUSHBUTTON   0x0100
 Default pushbutton. More...
 
#define DLGC_PUSHBUTTON   0x0200
 Non-default pushbutton. More...
 
#define DLGC_RADIOBUTTON   0x0400
 Radio button. More...
 
#define DLGC_3STATE   0x0800
 3 States button item. More...
 
#define DLGC_STATIC   0x1000
 Static item: don't include. More...
 
#define DLGC_BUTTON   0x2000
 Button item: can be checked. More...
 

Typedefs

typedef struct _CTRLDATA CTRLDATA
 
typedef struct _DLGTEMPLATE DLGTEMPLATE
 

Functions

MG_EXPORT HWND GUIAPI CreateMainWindowIndirectParamEx (PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC WndProc, LPARAM lParam, const char *werdr_name, WINDOW_ELEMENT_ATTR *we_attrs, const char *window_name, const char *layer_name)
 Uses a dialog template and other information to create a modeless main window and controls in it, and pass a parameter to the window procedure. More...
 
static HWND GUIAPI CreateMainWindowIndirectParam (PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC WndProc, LPARAM lParam)
 A simplified version of CreateMainWindowIndirectParamEx. More...
 
static HWND GUIAPI CreateMainWindowIndirect (PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC WndProc)
 A simplified version of CreateMainWindowIndirectParam. More...
 
MG_EXPORT BOOL GUIAPI DestroyMainWindowIndirect (HWND hMainWin)
 Destroys a main window created by CreateMainWindowIndirectParam. More...
 
MG_EXPORT int GUIAPI DialogBoxIndirectParamEx (PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC DlgProc, LPARAM lParam, const char *werdr_name, WINDOW_ELEMENT_ATTR *we_attrs, const char *window_name, const char *layer_name)
 Creates a modal dialog box from a dialog box template in memory and other information. More...
 
static int GUIAPI DialogBoxIndirectParam (PDLGTEMPLATE pDlgTemplate, HWND hOwner, WNDPROC DlgProc, LPARAM lParam)
 A simplified version of DialogBoxIndirectParamEx. More...
 
MG_EXPORT BOOL GUIAPI EndDialog (HWND hDlg, int endCode)
 Destroys a modal dialog box, causing MiniGUI to end any processing for the dialog box. More...
 
MG_EXPORT void GUIAPI DestroyAllControls (HWND hWnd)
 Destroys all controls in a window. More...
 
MG_EXPORT HWND GUIAPI GetDlgDefPushButton (HWND hWnd)
 Get the default push button control in a window. More...
 
MG_EXPORT LINT GUIAPI GetDlgCtrlID (HWND hwndCtl)
 Get the integer identifier of a control. More...
 
MG_EXPORT HWND GUIAPI GetDlgItem (HWND hDlg, LINT nIDDlgItem)
 Retrieve the handle to a control in a dialog box. More...
 
MG_EXPORT UINT GUIAPI GetDlgItemInt (HWND hDlg, LINT nIDDlgItem, BOOL *lpTranslated, BOOL bSigned)
 Translates the text of a control in a dialog box into an integer value. More...
 
MG_EXPORT int GUIAPI GetDlgItemText (HWND hDlg, LINT nIDDlgItem, char *lpString, int nMaxCount)
 Retrieve the title or text associated with a control in a dialog box. More...
 
MG_EXPORT char *GUIAPI GetDlgItemText2 (HWND hDlg, LINT id, int *lenPtr)
 Retrieve the title or text associated with a control in a dialog box. More...
 
MG_EXPORT HWND GUIAPI GetNextDlgGroupItem (HWND hDlg, HWND hCtl, BOOL bPrevious)
 Retrieve the handle to the first control in a group of controls that precedes (or follows) the specified control in a dialog box. More...
 
MG_EXPORT HWND GUIAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious)
 Retrieve the handle to the first control that has the WS_TABSTOP style that precedes (or follows) the specified control. More...
 
MG_EXPORT LRESULT GUIAPI SendDlgItemMessage (HWND hDlg, LINT nIDDlgItem, UINT message, WPARAM wParam, LPARAM lParam)
 Send a message to the specified control in a dialog box. More...
 
MG_EXPORT BOOL GUIAPI SetDlgItemInt (HWND hDlg, LINT nIDDlgItem, UINT uValue, BOOL bSigned)
 Set the text of a control in a dialog box to the string representation of a specified integer value. More...
 
MG_EXPORT void GUIAPI CheckDlgButton (HWND hDlg, LINT nIDDlgItem, int nCheck)
 Changes the check status of a button control. More...
 
MG_EXPORT void GUIAPI CheckRadioButton (HWND hDlg, LINT idFirstButton, LINT idLastButton, LINT idCheckButton)
 Adds a check mark to (checks) a specified radio button in a group and removes a check mark from (clears) all other radio buttons in the group. More...
 
MG_EXPORT int GUIAPI IsDlgButtonChecked (HWND hDlg, LINT idButton)
 Determine whether a button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither. More...
 

Detailed Description

Macro Definition Documentation

◆ DLGC_3STATE

#define DLGC_3STATE   0x0800

3 States button item.

Definition at line 11510 of file window.h.

◆ DLGC_BUTTON

#define DLGC_BUTTON   0x2000

Button item: can be checked.

Definition at line 11520 of file window.h.

◆ DLGC_DEFPUSHBUTTON

#define DLGC_DEFPUSHBUTTON   0x0100

Default pushbutton.

Definition at line 11495 of file window.h.

◆ DLGC_HASSETSEL

#define DLGC_HASSETSEL   0x0080

Understands EM_SETSEL message.

Definition at line 11489 of file window.h.

◆ DLGC_PUSHBUTTON

#define DLGC_PUSHBUTTON   0x0200

Non-default pushbutton.

Definition at line 11500 of file window.h.

◆ DLGC_RADIOBUTTON

#define DLGC_RADIOBUTTON   0x0400

Radio button.

Definition at line 11505 of file window.h.

◆ DLGC_STATIC

#define DLGC_STATIC   0x1000

Static item: don't include.

Definition at line 11515 of file window.h.

◆ DLGC_WANTALLKEYS

#define DLGC_WANTALLKEYS   0x0004

Control wants all keys.

Definition at line 11473 of file window.h.

◆ DLGC_WANTARROWS

#define DLGC_WANTARROWS   0x0001

Control wants arrow keys.

Definition at line 11463 of file window.h.

◆ DLGC_WANTCHARS

#define DLGC_WANTCHARS   0x0008

Want MSG_CHAR messages.

Definition at line 11478 of file window.h.

◆ DLGC_WANTENTER

#define DLGC_WANTENTER   0x0010

Control wants enter keys.

Definition at line 11484 of file window.h.

◆ DLGC_WANTTAB

#define DLGC_WANTTAB   0x0002

Control wants tab keys.

Definition at line 11468 of file window.h.

Typedef Documentation

◆ CTRLDATA

typedef struct _CTRLDATA CTRLDATA

Structure which defines a control.

◆ DLGTEMPLATE

typedef struct _DLGTEMPLATE DLGTEMPLATE

Structure which defines a dialogbox.

Example:

static DLGTEMPLATE DlgInitProgress =
{
120, 150, 400, 130,
"VAM-CNC is initializing",
0, 0,
3, NULL,
0
};
static CTRLDATA CtrlInitProgress [] =
{
{
"static",
10, 10, 380, 16,
IDC_PROMPTINFO,
"Initialize...",
0
},
{
"progressbar",
10, 40, 380, 20,
IDC_PROGRESS,
0
},
{
"button",
170, 70, 60, 25,
IDOK,
"OK",
0
}
};

Function Documentation

◆ CheckDlgButton()

void GUIAPI CheckDlgButton ( HWND  hDlg,
LINT  nIDDlgItem,
int  nCheck 
)

Changes the check status of a button control.

This function changes the check status of the button control whose identifier is nIDDlgItem in the dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
nCheckThe state of the button. If the button is a normal button, the value being zero means the button is checked, otherwise unchecked. If the button is a special button with three states, the value can be one of the following values:
  • BST_UNCHECKED
    The button is unchecked.
  • BST_CHECKED
    The button is checked.
  • BST_INDETERMINATE
    The button is in indeterminate state.
Note
The type of nIDDlgItem changed from int to LINT since v3.2.
See also
CheckRadioButton, IsDlgButtonChecked

◆ CheckRadioButton()

void GUIAPI CheckRadioButton ( HWND  hDlg,
LINT  idFirstButton,
LINT  idLastButton,
LINT  idCheckButton 
)

Adds a check mark to (checks) a specified radio button in a group and removes a check mark from (clears) all other radio buttons in the group.

This function adds a check mark to (checks) the specified radio button idCheckButton in a group between idFirstButton and idLastButton, and removes a check mark from (clears) all other radio buttons in the group.

Parameters
hDlgThe handle to the dialog box.
idFirstButtonThe identifier of the first control in the group.
idLastButtonThe identifier of the last control in the group.
idCheckButtonThe identifier of the control to be checked.
Note
The type of idFirstButton, idLastButton, and idCheckButton changed from int to LINT since v3.2.
See also
CheckDlgButton

◆ CreateMainWindowIndirect()

HWND GUIAPI CreateMainWindowIndirect ( PDLGTEMPLATE  pDlgTemplate,
HWND  hOwner,
WNDPROC  WndProc 
)
inlinestatic

A simplified version of CreateMainWindowIndirectParam.

This function creates a main window by calling CreateMainWindowIndirectParam function and passing 0 for lParam parameter.

See also
CreateMainWindowIndirectParam

Definition at line 11649 of file window.h.

◆ CreateMainWindowIndirectParam()

HWND GUIAPI CreateMainWindowIndirectParam ( PDLGTEMPLATE  pDlgTemplate,
HWND  hOwner,
WNDPROC  WndProc,
LPARAM  lParam 
)
inlinestatic

A simplified version of CreateMainWindowIndirectParamEx.

This function creates a main window by calling CreateMainWindowIndirectParamEx function and passing NULL for werdr_name, we_attrs, window_name, and layer_name parameters.

See also
CreateMainWindowIndirectParamEx

Definition at line 11630 of file window.h.

◆ CreateMainWindowIndirectParamEx()

HWND GUIAPI CreateMainWindowIndirectParamEx ( PDLGTEMPLATE  pDlgTemplate,
HWND  hOwner,
WNDPROC  WndProc,
LPARAM  lParam,
const char *  werdr_name,
WINDOW_ELEMENT_ATTR we_attrs,
const char *  window_name,
const char *  layer_name 
)

Uses a dialog template and other information to create a modeless main window and controls in it, and pass a parameter to the window procedure.

This function uses a dialog template pointed to by pDlgTemplate and other information to create a modeless main window and controls in it. The parameter specified by lParam will be passed to the window procedure as the second paramter of MSG_INITDIALOG message.

Parameters
pDlgTemplateThe pointer to a DLGTEMPLATE structure.
hOwnerThe handle to the hosting main window.
WndProcThe window procedure of the new main window.
lParamThe parameter will be passed to the window procedure.
werdr_nameThe name of window element renderer. NULL for default renderer.
we_attrsThe pointer to window element attribute table. NULL for default window attribute table.
window_nameThe window name; reserved for future use.
layer_nameThe layer name; reserved for future use.
Returns
Handle to the new main window, HWND_INVALID on error.
See also
CreateMainWindowIndirectParam, DestroyMainWindowIndirect, DialogBoxIndirectParam, DLGTEMPLATE

◆ DestroyAllControls()

void GUIAPI DestroyAllControls ( HWND  hWnd)

Destroys all controls in a window.

This function destroys all controls (child windows) in a window.

Parameters
hWndThe handle to the window.
See also
DestroyWindow

◆ DestroyMainWindowIndirect()

BOOL GUIAPI DestroyMainWindowIndirect ( HWND  hMainWin)

Destroys a main window created by CreateMainWindowIndirectParam.

This function destroys the main window which was created by CreateMainWindowIndirectParam function.

Parameters
hMainWinThe handle to the main window.
See also
CreateMainWindowIndirectParam

◆ DialogBoxIndirectParam()

int GUIAPI DialogBoxIndirectParam ( PDLGTEMPLATE  pDlgTemplate,
HWND  hOwner,
WNDPROC  DlgProc,
LPARAM  lParam 
)
inlinestatic

A simplified version of DialogBoxIndirectParamEx.

This function creates a dialog box by calling DialogBoxIndirectParamEx function and passing NULL for werdr_name, we_attrs, window_name, and layer_name parameters.

See also
DialogBoxIndirectParamEx

Definition at line 11717 of file window.h.

◆ DialogBoxIndirectParamEx()

int GUIAPI DialogBoxIndirectParamEx ( PDLGTEMPLATE  pDlgTemplate,
HWND  hOwner,
WNDPROC  DlgProc,
LPARAM  lParam,
const char *  werdr_name,
WINDOW_ELEMENT_ATTR we_attrs,
const char *  window_name,
const char *  layer_name 
)

Creates a modal dialog box from a dialog box template in memory and other information.

This function creates a modal dialog box from a dialog box template in memory and other information. Before displaying the dialog box, the function passes an application-defined value to the dialog box procedure as the second parameter of the MSG_INITDIALOG message. An application can use this value to initialize the controls in the dialog box.

Parameters
pDlgTemplateThe pointer to a DLGTEMPLATE structure.
hOwnerThe handle to the hosting main window.
DlgProcThe window procedure of the new dialog box.
lParamThe parameter will be passed to the window procedure.
werdr_nameThe name of window element renderer. NULL for default renderer.
we_attrsThe pointer to window element attribute table. NULL for default window attribute table.
window_nameThe window name; reserved for future use.
layer_nameThe layer name; reserved for future use.
Returns
Return value of the dialog box, i.e., the second argument passed to EndDialog function which closes the dialog box.
See also
EndDialog, DialogBoxIndirectParam, CreateMainWindowIndirectParam, DLGTEMPLATE

◆ EndDialog()

BOOL GUIAPI EndDialog ( HWND  hDlg,
int  endCode 
)

Destroys a modal dialog box, causing MiniGUI to end any processing for the dialog box.

This function destroys the modal dialog box hDlg created by DialogBoxIndirectParam and ends any processing for the dialog box. The argument endCode will be returned by DialogBoxIndirectParam as the return value.

Parameters
hDlgThe handle to the dialog box.
endCodeThe value will be returned by DialogBoxIndirectParam.
Returns
TRUE on success, FALSE on error.
See also
DialogBoxIndirectParam

◆ GetDlgCtrlID()

LINT GUIAPI GetDlgCtrlID ( HWND  hwndCtl)

Get the integer identifier of a control.

This function gets the integer identifier of the control hwndCtl.

Parameters
hwndCtlThe handle to the control.
Returns
The identifier of the control, -1 for error.
Note
The type of return value changed from int to LINT since v3.2.
See also
GetDlgItem

◆ GetDlgDefPushButton()

HWND GUIAPI GetDlgDefPushButton ( HWND  hWnd)

Get the default push button control in a window.

This function gets the handle to the default push button (with BS_DEFPUSHBUTTON style) in the specified window hWnd.

Parameters
hWndThe handle to the window.
Returns
The handle to the default push button, zero for non default push button in the window.

◆ GetDlgItem()

HWND GUIAPI GetDlgItem ( HWND  hDlg,
LINT  nIDDlgItem 
)

Retrieve the handle to a control in a dialog box.

This function retrieves the handle to a control, whose identifier is nIDDlgItem, in the specified dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
Note
The type of nIDDlgItem changed from int to LINT since v3.2.
Returns
The handle to the control, zero for not found.

◆ GetDlgItemInt()

UINT GUIAPI GetDlgItemInt ( HWND  hDlg,
LINT  nIDDlgItem,
BOOL lpTranslated,
BOOL  bSigned 
)

Translates the text of a control in a dialog box into an integer value.

This function translates the text of the control, whose identifier is nIDDlgItem in the dialog box hDlg into an integer value.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
lpTranslatedThe pointer to a boolean value, which indicates whether translated successfully.
bSignedIndicates whether handle the text as a signed integer.
Returns
The translated 32-bit integer.
Note
MiniGUI uses strtol or strtoul to convert the string value to a 32-bit integer, and pass the base as 0. Thus, the valid string value should be in the following forms:
  • [+|-]0x[0-9|A-F]*
    Will be read in base 16.
  • [+|-]0[0-7]*
    Will be read in base 8.
  • [+|-][1-9][0-9]*
    Will be read in base 10.
Note
The type of nIDDlgItem changed from int to LINT since v3.2.
See also
GetDlgItemText, SetDlgItemInt

◆ GetDlgItemText()

int GUIAPI GetDlgItemText ( HWND  hDlg,
LINT  nIDDlgItem,
char *  lpString,
int  nMaxCount 
)

Retrieve the title or text associated with a control in a dialog box.

This function retrieves the title or text associated with a control, whose identifier is nIDDlgItem in the dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
lpStringThe pointer to a buffer which receives the text.
nMaxCountThe maximal length of the string, not including the null character.
Returns
The length of the null-terminated text.
Note
The buffer should at least have size of (nMaxCount + 1).
The type of nIDDlgItem changed from int to LINT since v3.2.
See also
GetDlgItemInt, GetDlgItemText2

◆ GetDlgItemText2()

char *GUIAPI GetDlgItemText2 ( HWND  hDlg,
LINT  id,
int *  lenPtr 
)

Retrieve the title or text associated with a control in a dialog box.

This function is similiar as GetDlgItemText function, but it allocates memory for the text and returns the pointer to the allocated buffer. You should free the buffer when done by using free function.

Parameters
hDlgThe handle to the dialog box.
idThe identifier of the control.
lenPtrThe pointer to an integer which receives the length of the text if it is not NULL.
Returns
The pointer to the allocated buffer.
Note
The type of id changed from int to LINT since v3.2.
See also
GetDlgItemText

◆ GetNextDlgGroupItem()

HWND GUIAPI GetNextDlgGroupItem ( HWND  hDlg,
HWND  hCtl,
BOOL  bPrevious 
)

Retrieve the handle to the first control in a group of controls that precedes (or follows) the specified control in a dialog box.

This function retrieves the handle to the first control in a group of controls that precedes (or follows) the specified control hCtl in the dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
hCtlThe handle to the control.
bPreviousA boolean value indicates to retrive the preceding or following control. TRUE for preceding control.
Returns
The handle to the preceding or following control.
See also
GetNextDlgTabItem

◆ GetNextDlgTabItem()

HWND GUIAPI GetNextDlgTabItem ( HWND  hDlg,
HWND  hCtl,
BOOL  bPrevious 
)

Retrieve the handle to the first control that has the WS_TABSTOP style that precedes (or follows) the specified control.

This function retrieves the handle to the first control that has the WS_TABSTOP style that precedes (or follows) the specified control hCtl in the dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
hCtlThe handle to the control.
bPreviousA boolean value indicates to retrive the preceding or following control. TRUE for preceding control.
Returns
The handle to the preceding or following control.
See also
GetNextDlgGroupItem

◆ IsDlgButtonChecked()

int GUIAPI IsDlgButtonChecked ( HWND  hDlg,
LINT  idButton 
)

Determine whether a button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither.

This function determines whether the button control whose identifier is idButton has a check mark next to it or whether a three-state button control is grayed, checked, or neither.

Parameters
hDlgThe handle to the dialog box.
idButtonThe identifier of the button.
Returns
The check state of the button. If the button is a normal button, the value being zero means the button is checked, otherwise unchecked. If the button is a special button with three states, the value can be one of the following values:
  • BST_UNCHECKED
    The button is unchecked.
  • BST_CHECKED
    The button is checked.
  • BST_INDETERMINATE
    The button is in indeterminate state.
Note
The type of idButton tem changed from int to LINT since v3.2.
See also
CheckDlgButton

◆ SendDlgItemMessage()

LRESULT GUIAPI SendDlgItemMessage ( HWND  hDlg,
LINT  nIDDlgItem,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Send a message to the specified control in a dialog box.

This function sends a message specified by (message, wParam, lParam) to the specified control whose identifier is nIDDlgItem in the dialog box hDlg.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
messageThe message identifier.
wParamThe first message parameter.
lParamThe second message parameter.
Returns
The return value of the message handler.
Note
The type of nIDDlgItem changed from int to LINT since v3.2.
See also
SendMessage, GetDlgItem

◆ SetDlgItemInt()

BOOL GUIAPI SetDlgItemInt ( HWND  hDlg,
LINT  nIDDlgItem,
UINT  uValue,
BOOL  bSigned 
)

Set the text of a control in a dialog box to the string representation of a specified integer value.

This function sets the text of the control whose identifier is nIDDlgItem in the dialog box hDlg to the string representation of the specified integer value nValue.

Parameters
hDlgThe handle to the dialog box.
nIDDlgItemThe identifier of the control.
uValueThe 32-bit integer value.
bSignedA boolean value indicates whether the integer value is a signed integer.
Returns
TRUE on success, FALSE on error.
Note
The type of nIDDlgItem changed from int to LINT since v3.2.
See also
GetDlgItemInt, SetDlgItemText
SS_SIMPLE
#define SS_SIMPLE
Designates a simple rectangle and displays a single line of text flush-left in the rectangle.
Definition: static.h:96
WS_VISIBLE
#define WS_VISIBLE
Creates a window initially visible.
Definition: window.h:4292
NULL
#define NULL
A value indicates null pointer.
Definition: common.h:369
_CTRLDATA
Definition: window.h:11525
_DLGTEMPLATE
Definition: window.h:11559
WS_BORDER
#define WS_BORDER
Creates a window with border.
Definition: window.h:4338
BS_DEFPUSHBUTTON
#define BS_DEFPUSHBUTTON
Creates a push button that behaves like a BS_PUSHBUTTON style button.
Definition: button.h:116
WS_CAPTION
#define WS_CAPTION
Creates a main window with caption.
Definition: window.h:4277
WS_EX_NONE
#define WS_EX_NONE
No any extended window style.
Definition: window.h:4388
WS_TABSTOP
#define WS_TABSTOP
Indicates the user can set the input focus to the control by using Tab key.
Definition: window.h:4363