MiniGUI API Reference (MiniGUI-Standalone)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Data Structures | Typedefs | Functions
Window class operations

Data Structures

struct  _WNDCLASS
 

Typedefs

typedef struct _WNDCLASS WNDCLASS
 

Functions

MG_EXPORT BOOL GUIAPI RegisterWindowClass (PWNDCLASS pWndClass)
 Registers a window class. More...
 
MG_EXPORT BOOL GUIAPI UnregisterWindowClass (const char *szClassName)
 Undoes the effect of RegisterWindowClass. More...
 
MG_EXPORT const char *GUIAPI GetClassName (HWND hWnd)
 Retrieves the name of the class to which the specified window belongs. More...
 
MG_EXPORT BOOL GUIAPI GetWindowClassInfo (PWNDCLASS pWndClass)
 Retrieves the information of the specified window class. More...
 
MG_EXPORT BOOL GUIAPI SetWindowClassInfo (const WNDCLASS *pWndClass)
 Sets the information of the specified window class. More...
 

Detailed Description

Typedef Documentation

typedef struct _WNDCLASS WNDCLASS

Structure defines a window class

Function Documentation

const char *GUIAPI GetClassName ( HWND  hWnd)

Retrieves the name of the class to which the specified window belongs.

This function retrieves the name of the class to which the specified window hWnd belongs.

Parameters
hWndThe handle to the window.
Returns
The pointer to a const class name string, NULL on error.
See also
RegisterWindowClass
BOOL GUIAPI GetWindowClassInfo ( PWNDCLASS  pWndClass)

Retrieves the information of the specified window class.

This function retrives the information of a window class. The window class to be retrived is specified by pWndClass->spClassName.

Parameters
pWndClassThe pointer to a WNDCLASS structure, which specifies the window class to be retrived via spClassName field, and returns the information through other fields.
Returns
TRUE on success, FALSE on error.
See also
SetWindowClassInfo
BOOL GUIAPI RegisterWindowClass ( PWNDCLASS  pWndClass)

Registers a window class.

This function registers a window class. Later on, you can create a window of the registered class.

Parameters
pWndClassThe pointer to a WNDCLASS structure which specifies the information of the window class.
Returns
TRUE on success, FALSE on error.
See also
UnregisterWindowClass, WNDCLASS

Example:

#define STEP_CTRL_NAME "mystep"
#define MSG_SET_STEP_INFO (MSG_USER + 1)
#define MSG_SET_CURR_STEP (MSG_USER + 2)
static LRESULT StepControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
HELPWININFO* info;
switch (message) {
case MSG_PAINT:
hdc = BeginPaint (hwnd);
/* Get the step information. */
info = (HELPWININFO*)GetWindowAdditionalData (hwnd);
/* Draw the step information. */
......
EndPaint (hwnd, hdc);
break;
/* A message defined by the control, used to set the step information. */
case MSG_SET_STEP_INFO:
SetWindowAdditionalData (hwnd, (DWORD)lParam);
break;
/*
* A message defined by the control, used to set the information
* of the current step.
*/
case MSG_SET_CURR_STEP:
break;
break;
}
return DefaultControlProc (hwnd, message, wParam, lParam);
}
static BOOL RegisterStepControl ()
{
int result;
WNDCLASS StepClass;
StepClass.spClassName = STEP_CTRL_NAME;
StepClass.dwStyle = 0;
StepClass.WinProc = StepControlProc;
return RegisterWindowClass (&StepClass);
}
static void UnregisterStepControl ()
{
UnregisterWindowClass (STEP_CTRL_NAME);
}
BOOL GUIAPI SetWindowClassInfo ( const WNDCLASS pWndClass)

Sets the information of the specified window class.

This function sets the information of a window class. The window class to be operated is specified by pWndClass->spClassName.

Parameters
pWndClassThe pointer to a WNDCLASS structure, which specifies the new information of the window class.
Returns
TRUE on success, FALSE on error.
See also
GetWindowClassInfo
BOOL GUIAPI UnregisterWindowClass ( const char *  szClassName)

Undoes the effect of RegisterWindowClass.

This function unregisters a registered window class specified by szClassName.

Parameters
szClassNameThe name of the class to be unregistered.
Returns
TRUE on success, FALSE on error.
See also
RegisterWindowClass