mGUtils API Reference  v1.2.0
A component of MiniGUI providing users with a number of common dialog templates
Data Structures | Typedefs | Functions
Interfaces of MyWins module of mGUtils library

Data Structures

struct  _myWinButton
 
struct  _myWinEntry
 

Typedefs

typedef struct _myWinButton myWINBUTTON
 
typedef struct _myWinEntry myWINENTRY
 

Functions

MGUTILS_EXPORT int myMessageBox (HWND hwnd, DWORD dwStyle, const char *title, const char *text,...)
 Creates a message box. More...
 
MGUTILS_EXPORT int myWinMessage (HWND hwnd, const char *title, const char *button1, const char *text,...)
 Creates a message box within only one button. More...
 
MGUTILS_EXPORT int myWinChoice (HWND hwnd, const char *title, const char *button1, const char *button2, const char *text,...)
 Creates a message box within two buttons. More...
 
MGUTILS_EXPORT int myWinTernary (HWND hwnd, const char *title, const char *button1, const char *button2, const char *button3, const char *text,...)
 Creates a message box within three buttons. More...
 
MGUTILS_EXPORT void errorWindow (HWND hwnd, const char *str, const char *title)
 A MiniGUI edition of perror. More...
 
MGUTILS_EXPORT HWND createStatusWin (HWND hParentWnd, int width, int height, const char *title, const char *text,...)
 Creates a status main window. More...
 
MGUTILS_EXPORT void destroyStatusWin (HWND hwnd)
 Destroies a status window. More...
 
MGUTILS_EXPORT HWND createProgressWin (HWND hParentWnd, const char *title, const char *label, int id, int range)
 Creates a main window within a progress bar. More...
 
MGUTILS_EXPORT void destroyProgressWin (HWND hwnd)
 Destroies progress window. More...
 
MGUTILS_EXPORT int myWinMenu (HWND hParentWnd, const char *title, const char *label, int width, int listboxheight, char **items, int *listItem, myWINBUTTON *buttons)
 Creates a menu main window for the user to select an item. More...
 
MGUTILS_EXPORT int myWinEntries (HWND hParentWnd, const char *title, const char *label, int width, int editboxwidth, BOOL fIME, myWINENTRY *items, myWINBUTTON *buttons)
 Creates a entry main window for the user to enter something. More...
 
MGUTILS_EXPORT int myWinHelpMessage (HWND hwnd, int width, int height, const char *help_title, const char *help_msg)
 Creates a help message window. More...
 

Detailed Description

This module defines some useful helpers, such as tool-tip window, progress window, and so on.

Typedef Documentation

typedef struct _myWinButton myWINBUTTON

Button info structure used by myWinMenu and myWinEntries function.

See also
myWinMenu, myWinEntries
typedef struct _myWinEntry myWINENTRY

Entry info structure used by myWinEntries function.

See also
myWinEntries

Function Documentation

HWND createProgressWin ( HWND  hParentWnd,
const char *  title,
const char *  label,
int  id,
int  range 
)

Creates a main window within a progress bar.

This function creates a main window within a progress bar and returns the handle. You can call destroyProgressWin to destroy it.

Note that you can use SendDlgItemMessage to send a message to the progress bar in the main window in order to update the progress bar.

Parameters
hParentWndThe hosting main window.
titleThe title of the progress window.
labelThe text in the label of the progress bar.
idThe identifier of the progress bar.
rangeThe maximal value of the progress bar (minimal value is 0).
Returns
The handle to the progress window on success, HWND_INVALID on error.
See also
destroyProgressWin
HWND createStatusWin ( HWND  hParentWnd,
int  width,
int  height,
const char *  title,
const char *  text,
  ... 
)

Creates a status main window.

This function creates a status main window and returns the handle to it. You can call destroyStatusWin to destroy it. This function also receives printf-like arguments to format a string.

Parameters
hParentWndThe hosting main window.
widthThe width of the status window.
heightThe height of the status window.
titleThe title of the status window.
textThe format string.
Returns
The handle to the status window on success, HWND_INVALID on error.
See also
destroyStatusWin
void destroyProgressWin ( HWND  hwnd)

Destroies progress window.

This function destroies the specified progress window hwnd, which is returned by createProgressWin.

Parameters
hwndThe handle to the progress window.
See also
createProgressWin
void destroyStatusWin ( HWND  hwnd)

Destroies a status window.

This function destroies the specified status window hwnd, which is returned by createStatusWin.

Parameters
hwndThe handle to the status window.
See also
createStatusWin
void errorWindow ( HWND  hwnd,
const char *  str,
const char *  title 
)

A MiniGUI edition of perror.

This function creates a message box by using myMessageBox, and display the current system error message. You can consider it as an alternative of perror.

Parameters
hwndThe hosting main window.
strThe string will be appeared before the system error message.
titleThe title of the message box.
See also
myMessageBox, perror(3)
int myMessageBox ( HWND  hwnd,
DWORD  dwStyle,
const char *  title,
const char *  text,
  ... 
)

Creates a message box.

This function creates a message box calling MessageBox and passing hwnd, dwStyle and title to it. This function also receives printf-like arguments to format a string.

Parameters
hwndThe hosting main window.
dwStyleThe style of the message box.
titleThe title of the message box.
textThe format string.
Returns
Identifier of the button which closes the message box.
See also
MessageBox, printf(3)
int myWinChoice ( HWND  hwnd,
const char *  title,
const char *  button1,
const char *  button2,
const char *  text,
  ... 
)

Creates a message box within two buttons.

This function creates a message box hosted to the main window hwnd, displays a message and an application icon in the message box, and creates two buttons in it. This function also receives printf-like arguments to format a string.

This function can be used to prompt the user to choose one item between two.

Parameters
hwndThe hosting main window.
titleThe title of the message box.
button1The title of the first button.
button2The title of the second button.
textThe format string.
Returns
Either 0 or 1, indicates the message box was closed by the first or second button.
See also
myWinTernary, printf(3)
int myWinEntries ( HWND  hParentWnd,
const char *  title,
const char *  label,
int  width,
int  editboxwidth,
BOOL  fIME,
myWINENTRY items,
myWINBUTTON buttons 
)

Creates a entry main window for the user to enter something.

This function creates a entry main window including a few buttons and a few entries.

When the user click one of the buttons, this function will return the identifier of the button which leads to close the menu window, and the entered strings.

Parameters
hParentWndThe hosting main window.
titleThe title of the menu main window.
labelThe label of the entries.
widthThe width of the menu main window.
editboxwidthThe width of the edit boxes.
fIMEWhether active the IME window (obsolete).
itemsThe pointer to the array of the entries, initial and returned.
buttonsThe buttons will be created.
Returns
Returns the identifier of the button leading to close the menu window on success, else on errors.
See also
myWINBUTTON, myWINENTRY
int myWinHelpMessage ( HWND  hwnd,
int  width,
int  height,
const char *  help_title,
const char *  help_msg 
)

Creates a help message window.

This function creates a help message window including a scrollable help message and a spin box. When the user click the OK button, this function will return.

Parameters
hwndThe hosting main window.
widthThe width of the help message window.
heightThe height of the help message window.
help_titleThe title of the window.
help_msgThe help message.
Returns
0 on success, -1 on error.
int myWinMenu ( HWND  hParentWnd,
const char *  title,
const char *  label,
int  width,
int  listboxheight,
char **  items,
int *  listItem,
myWINBUTTON buttons 
)

Creates a menu main window for the user to select an item.

This function creates a menu main window including a few buttons, and a list box with checkable item.

When the user click one of the buttons, this function will return the identifier of the button which leads to close the menu window, and the selections of the items via listItem.

Parameters
hParentWndThe hosting main window.
titleThe title of the menu main window.
labelThe label of the list box.
widthThe width of the menu main window.
listboxheightThe height of the list box.
itemsThe pointer to the array of the item strings.
listItemThe pointer to the array of the check status of the items, initial and returned.
buttonsThe buttons will be created.
Returns
Returns the identifier of the button leading to close the menu window on success, else on errors.
See also
myWINBUTTON
int myWinMessage ( HWND  hwnd,
const char *  title,
const char *  button1,
const char *  text,
  ... 
)

Creates a message box within only one button.

This function creates a message box hosted to the main window hwnd, displays a message and an application icon in the message box, and creates a button which can be used to close the box. This function also receives printf-like arguments to format a string.

This function can be used to display a information for the user.

Parameters
hwndThe hosting main window.
titleThe title of the message box.
button1The text in the button.
textThe format string.
Returns
0 indicates the message box was closed by clicking the only button.
See also
myWinChoice, printf(3)
int myWinTernary ( HWND  hwnd,
const char *  title,
const char *  button1,
const char *  button2,
const char *  button3,
const char *  text,
  ... 
)

Creates a message box within three buttons.

This function creates a message box hosted to the main window hwnd, displays a message and an application icon in the message box, and creates three buttons in it. This function also receives printf-like arguments to format a string.

This function can be used to prompt the user to choose one item among three choices.

Parameters
hwndThe hosting main window.
titleThe title of the message box.
button1The title of the first button.
button2The title of the second button.
button3The title of the third button.
textThe format string.
Returns
0, 1, or 2, indicates the message box was closed by the first, the second, or the third button.
See also
myWinChoice, printf(3)