MiniGUI API Reference (MiniGUI-Processes)  v5.0.6
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...
 
const MG_EXPORT char *GUIAPI GetClassName (HWND hWnd)
 Retrieve the name of the class to which the specified window belongs. More...
 
MG_EXPORT BOOL GUIAPI GetWindowClassInfo (PWNDCLASS pWndClass)
 Retrieve the information of the specified window class. More...
 
MG_EXPORT BOOL GUIAPI SetWindowClassInfo (const WNDCLASS *pWndClass)
 Set the information of the specified window class. More...
 

Detailed Description

Typedef Documentation

◆ WNDCLASS

typedef struct _WNDCLASS WNDCLASS

Structure defines a window class

Function Documentation

◆ GetClassName()

const char *GUIAPI GetClassName ( HWND  hWnd)

Retrieve 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

◆ GetWindowClassInfo()

BOOL GUIAPI GetWindowClassInfo ( PWNDCLASS  pWndClass)

Retrieve the information of the specified window class.

This function retrieves 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

◆ RegisterWindowClass()

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 (void)
{
int result;
WNDCLASS StepClass;
StepClass.spClassName = STEP_CTRL_NAME;
StepClass.dwStyle = 0;
#ifdef _MGSCHEMA_COMPOSITING
StepClass.dwBkRGBA = COLOR_lightwhite;
#else
StepClass.iBkColor = PIXEL_lightwhite;
#endif
StepClass.WinProc = StepControlProc;
return RegisterWindowClass (&StepClass);
}
static void UnregisterStepControl (void)
{
UnregisterWindowClass (STEP_CTRL_NAME);
}

◆ SetWindowClassInfo()

BOOL GUIAPI SetWindowClassInfo ( const WNDCLASS pWndClass)

Set 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

◆ UnregisterWindowClass()

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
_WNDCLASS
Definition: window.h:9677
EndPaint
MG_EXPORT void GUIAPI EndPaint(HWND hWnd, HDC hdc)
Marks the end of painting in a window.
NULL
#define NULL
A value indicates null pointer.
Definition: common.h:369
COLOR_lightwhite
#define COLOR_lightwhite
Definition: gdi.h:408
GetWindowAdditionalData
MG_EXPORT DWORD GUIAPI GetWindowAdditionalData(HWND hWnd)
Retrieve the first additional data of a window.
DWORD
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:604
HWND
GHANDLE HWND
Handle to main window or control.
Definition: common.h:407
HDC
GHANDLE HDC
Handle to device context.
Definition: common.h:412
_WNDCLASS::WinProc
LRESULT(* WinProc)(HWND, UINT, WPARAM, LPARAM)
Definition: window.h:9738
GetSystemCursor
MG_EXPORT HCURSOR GUIAPI GetSystemCursor(int csrid)
Get the handle to a system cursor by its identifier.
MSG_DESTROY
#define MSG_DESTROY
Indicates the window will be destroyed.
Definition: window.h:1401
_WNDCLASS::spClassName
const char * spClassName
Definition: window.h:9679
WPARAM
UINT_PTR WPARAM
A type definition for the first message paramter.
Definition: common.h:706
LRESULT
LONG_PTR LRESULT
Signed result of message processing.
Definition: common.h:583
UINT
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:664
IDC_ARROW
#define IDC_ARROW
Definition: minigui.h:3934
PIXEL_lightwhite
#define PIXEL_lightwhite
Light white.
Definition: gdi.h:299
FALSE
#define FALSE
FALSE value, defined as 0 by MiniGUI.
Definition: common.h:351
BOOL
int BOOL
A type definition for boolean value.
Definition: common.h:343
SetWindowAdditionalData
MG_EXPORT DWORD GUIAPI SetWindowAdditionalData(HWND hWnd, DWORD newData)
Set the first additional data of a window.
MSG_PAINT
#define MSG_PAINT
Sent to the window if the window contains an invalid region.
Definition: window.h:2127
_WNDCLASS::dwStyle
DWORD dwStyle
Definition: window.h:9696
_WNDCLASS::hCursor
HCURSOR hCursor
Definition: window.h:9702
RegisterWindowClass
MG_EXPORT BOOL GUIAPI RegisterWindowClass(PWNDCLASS pWndClass)
Registers a window class.
InvalidateRect
MG_EXPORT BOOL GUIAPI InvalidateRect(HWND hWnd, const RECT *prc, BOOL bEraseBkgnd)
Makes a rectangle region in the client area of a window invalid.
TRUE
#define TRUE
TRUE value, defined as 1 by MiniGUI.
Definition: common.h:358
LPARAM
UINT_PTR LPARAM
A type definition for the second message paramter.
Definition: common.h:712
UnregisterWindowClass
MG_EXPORT BOOL GUIAPI UnregisterWindowClass(const char *szClassName)
Undoes the effect of RegisterWindowClass.
DefaultControlProc
#define DefaultControlProc
The default control callback procedure.
Definition: window.h:7416
BeginPaint
MG_EXPORT HDC GUIAPI BeginPaint(HWND hWnd)
Prepares a window for painting.